List of usage examples for org.eclipse.jdt.core.dom IBinding toString
@Override
public String toString();
From source file:com.google.devtools.j2cpp.util.NameTable.java
License:Open Source License
/** * Adds a name to the renamings map, used by getName(). *//*from ww w . j a v a2s.c o m*/ public static void rename(IBinding oldName, String newName) { oldName = getBindingDeclaration(oldName); String previousName = instance.renamings.get(oldName); if (previousName != null && !previousName.equals(newName)) { logger.fine(String.format("Changing previous rename: %s => %s, now: %s => %s", oldName.toString(), previousName, oldName, newName)); } rename(oldName, newName, false); }
From source file:net.sf.j2s.core.astvisitors.Bindings.java
License:Open Source License
/** * Note: this method is for debugging and testing purposes only. * There are tests whose pre-computed test results rely on the returned String's format. * @see org.eclipse.jdt.internal.ui.viewsupport.BindingLabelProvider *///from w ww . j ava2 s .com public static String asString(IBinding binding) { if (binding instanceof IMethodBinding) return asString((IMethodBinding) binding); else if (binding instanceof ITypeBinding) return asString((ITypeBinding) binding); else if (binding instanceof IVariableBinding) return asString((IVariableBinding) binding); return binding.toString(); }
From source file:org.arc4eclipse.panelExerciser.BindingListAndPanel.java
License:Open Source License
private void initGUI() { try {//from w w w . j a va2 s.c om final IBindingRipper bindingRipper = IBindingRipper.Utils.ripper(); FormLayout thisLayout = new FormLayout(); this.setLayout(thisLayout); this.setSize(648, 168); { FormData sashForm1LData = new FormData(); sashForm1LData.left = new FormAttachment(0, 1000, 6); sashForm1LData.top = new FormAttachment(0, 1000, 6); sashForm1LData.width = 642; sashForm1LData.height = 162; sashForm1LData.bottom = new FormAttachment(1000, 1000, 0); sashForm1LData.right = new FormAttachment(1000, 1000, 0); sashForm1 = new SashForm(this, SWT.NONE); sashForm1.setLayoutData(sashForm1LData); { fileList1 = new BindingList(sashForm1, SWT.NONE); fileList1.setBounds(0, 0, 222, 162); fileList1.addFireSelectionListener(new IBindingSelectedListener() { @Override public void bindingSelected(IBinding binding) { try { selectedArtefactPanel.setData(binding); String text = binding == null ? "" : binding.toString(); BindingRipperResult ripperResult = bindingRipper.apply(binding); text1.setText(text + "\n" + ripperResult); } catch (Exception e) { throw WrappedException.wrap(e); } } }); } { sashForm2 = new SashForm(sashForm1, SWT.NONE); sashForm2.setOrientation(SWT.VERTICAL); { text1 = new Text(sashForm2, SWT.MULTI | SWT.WRAP); text1.setText("text1"); } { selectedArtefactPanel = new SelectedArtefactPanel(sashForm2, SWT.NONE, IDisplayManager.Utils.displayManager(), repository, bindingRipper); } } } this.layout(); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.eclipse.xtext.common.types.access.jdt.JdtBasedTypeFactory.java
License:Open Source License
/** * @since 2.7/* w ww.j av a2 s . c om*/ */ protected JvmDeclaredType createType(IType jdtType, IJavaProject javaProject) { if (jdtType.getDeclaringType() != null) throw new IllegalArgumentException( "Cannot create type from non-toplevel-type: '" + jdtType.getFullyQualifiedName() + "'."); IBinding binding = resolveBindings(jdtType, javaProject); if (binding == null) { IJavaProject fallbackProject = jdtType.getJavaProject(); // fallback to the project of the given jdtType if it is different from the explicitly given project if (!fallbackProject.equals(javaProject)) { binding = resolveBindings(jdtType, fallbackProject); if (binding == null) { throw new IllegalStateException("Could not create binding for '" + jdtType.getFullyQualifiedName() + "' in context of projects '" + javaProject.getElementName() + "' and '" + fallbackProject.getElementName() + "'."); } } else { throw new IllegalStateException("Could not create binding for '" + jdtType.getFullyQualifiedName() + "' in context of project '" + javaProject.getElementName() + "'."); } } if (binding instanceof ITypeBinding) { createType.start(); ITypeBinding typeBinding = (ITypeBinding) binding; setMayTolerateMissingType(typeBinding); JvmDeclaredType result = createType(jdtType, typeBinding); // Clear the cached information. // clearCache(); createType.stop(); return result; } else { throw new IllegalStateException("Expected ITypeBinding for '" + jdtType.getFullyQualifiedName() + "', but got '" + binding.toString() + "'."); } }
From source file:org.incha.core.jswingripples.parser.BindingSupport.java
License:Open Source License
/** * Note: this method is for debugging and testing purposes only. * There are tests whose pre-computed test results rely on the returned String's format. * @param binding the binding//from w w w. ja va 2 s.co m * @return a string representation of given binding * @see org.eclipse.jdt.internal.ui.viewsupport.BindingLabelProvider */ public String asString(final IBinding binding) { if (binding instanceof IMethodBinding) return asString((IMethodBinding) binding); else if (binding instanceof ITypeBinding) return ((ITypeBinding) binding).getQualifiedName(); else if (binding instanceof IVariableBinding) return asString((IVariableBinding) binding); return binding.toString(); }
From source file:org.summer.dsl.model.types.access.jdt.JdtBasedTypeFactory.java
License:Open Source License
public JvmDeclaredType createType(IType jdtType) { if (jdtType.getDeclaringType() != null) throw new IllegalArgumentException( "Cannot create type from non-toplevel-type: '" + jdtType.getFullyQualifiedName() + "'."); resolveBinding.start();/*from w w w . j a va 2s . c o m*/ parser.setWorkingCopyOwner(workingCopyOwner); parser.setIgnoreMethodBodies(true); IJavaProject project = jdtType.getJavaProject(); parser.setProject(project); @SuppressWarnings("unchecked") Map<Object, Object> options = project.getOptions(true); options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.DISABLED); parser.setCompilerOptions(options); IBinding[] bindings = parser.createBindings(new IJavaElement[] { jdtType }, null); resolveBinding.stop(); if (bindings[0] == null) throw new IllegalStateException( "Could not create binding for '" + jdtType.getFullyQualifiedName() + "'."); IBinding binding = bindings[0]; if (binding instanceof ITypeBinding) { createType.start(); ITypeBinding typeBinding = (ITypeBinding) binding; JvmDeclaredType result = createType(jdtType, typeBinding); // Clear the cached information. // clearCache(); createType.stop(); return result; } else throw new IllegalStateException("Expected ITypeBinding for '" + jdtType.getFullyQualifiedName() + "', but got '" + binding.toString() + "'."); }