List of usage examples for org.eclipse.jdt.core IType getFullyQualifiedName
String getFullyQualifiedName(char enclosingTypeSeparator);
From source file:ar.com.fluxit.jqa.wizard.page.ThrowingDefinitionWizardPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;//w w w. j a v a 2 s . c o m container.setLayout(layout); layersTable = new TableViewer(container, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); layersTable.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); layersTable.setContentProvider(ArrayContentProvider.getInstance()); layersTable.getTable().setHeaderVisible(true); layersTable.getTable().setLinesVisible(true); TableViewerColumn layerColumn = new TableViewerColumn(layersTable, SWT.NONE); layerColumn.getColumn().setText("Layer"); layerColumn.getColumn().setWidth(300); layerColumn.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { LayerDescriptor layer = (LayerDescriptor) element; return layer.getName(); } }); TableViewerColumn namePatternColumn = new TableViewerColumn(layersTable, SWT.NONE); namePatternColumn.getColumn().setWidth(300); namePatternColumn.getColumn().setText("Exception super type"); namePatternColumn.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { LayerDescriptor layer = (LayerDescriptor) element; return layer.getExceptionSuperType(); } }); namePatternColumn.setEditingSupport(new EditingSupport(layersTable) { @Override protected boolean canEdit(Object element) { return true; } @Override protected CellEditor getCellEditor(Object element) { TypeSelectionExtension extension = new TypeSelectionExtension() { @Override public ISelectionStatusValidator getSelectionValidator() { return new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection.length == 1) { try { IType type = (IType) selection[0]; ITypeHierarchy hierarchy = type .newSupertypeHierarchy(new NullProgressMonitor()); IType curr = type; while (curr != null) { if ("java.lang.Throwable".equals(curr.getFullyQualifiedName('.'))) { //$NON-NLS-1$ return Status.OK_STATUS; } curr = hierarchy.getSuperclass(curr); } } catch (JavaModelException e) { Status status = new Status(IStatus.ERROR, JQAEclipsePlugin.PLUGIN_ID, e.getLocalizedMessage(), e); JQAEclipsePlugin.getDefault().getLog().log(status); return Status.CANCEL_STATUS; } } return new Status(IStatus.ERROR, JQAEclipsePlugin.PLUGIN_ID, "Selected item is not an exception"); } }; } }; return new TypeCellEditor(layersTable.getTable(), ThrowingDefinitionWizardPage.this.getContainer(), IJavaSearchConstants.CLASS, "*Exception", extension); } @Override protected Object getValue(Object element) { return ((LayerDescriptor) element).getExceptionSuperType(); } @Override protected void setValue(Object element, Object value) { ((LayerDescriptor) element).setExceptionSuperType((String) value); layersTable.refresh(element, true); } }); layersTable.setInput(getArchitectureDescriptor().getLayers()); setControl(container); ((WizardDialog) getContainer()).addPageChangedListener(this); }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java
License:Open Source License
private String handlePreloaderclassSelection(Shell parent) { IFileEditorInput i = (IFileEditorInput) getEditorInput(); IJavaProject project = JavaCore.create(i.getFile().getProject()); if (project == null) { return null; }/*from www . j a va 2s . c o m*/ try { IType superType = project.findType("javafx.application.Preloader"); IJavaSearchScope searchScope = SearchEngine.createStrictHierarchyScope(project, superType, true, false, null); SelectionDialog dialog = JavaUI.createTypeDialog(parent, PlatformUI.getWorkbench().getProgressService(), searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, ""); dialog.setTitle("Find Preloader"); if (dialog.open() == Window.OK) { IType type = (IType) dialog.getResult()[0]; return type.getFullyQualifiedName('$'); } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
From source file:ca.mcgill.cs.swevo.jayfx.FastConverter.java
License:Open Source License
/** * Adds type to the converter/*from w ww . j a va 2 s .co m*/ * * @param pType * The actual type in a Java project */ public void addMapping(final IType pType) { this.aTypeMap.put(pType.getFullyQualifiedName('$'), pType); }
From source file:ca.mcgill.cs.swevo.jayfx.FastConverter.java
License:Open Source License
@SuppressWarnings("unused") private IElement getAspectElement(final IType pType) { return FlyweightElementFactory.getElement(Category.ASPECT, pType.getFullyQualifiedName('$')); }
From source file:ca.mcgill.cs.swevo.jayfx.FastConverter.java
License:Open Source License
private IElement getClassElement(final IType pType) { return FlyweightElementFactory.getElement(Category.CLASS, pType.getFullyQualifiedName('$')); }
From source file:ch.qos.logback.beagle.util.EditorUtil.java
License:Open Source License
private static String getFullyQualifiedName(IType type) { try {//from ww w . ja va 2s . co m if (type.isBinary() && !type.isAnonymous()) { IType declaringType = type.getDeclaringType(); if (declaringType != null) { return getFullyQualifiedName(declaringType) + '.' + type.getElementName(); } } } catch (JavaModelException e) { // ignore } return type.getFullyQualifiedName('.'); }
From source file:com.android.ide.eclipse.adt.internal.editors.manifest.model.UiClassAttributeNode.java
License:Open Source License
private void handleNewType(IType type) { Text text = getTextWidget();/*w w w . jav a 2s . co m*/ // get the fully qualified name with $ to properly detect the enclosing types. String name = type.getFullyQualifiedName('$'); String packageValue = getManifestPackage(); // check if the class doesn't start with the package. if (packageValue.length() > 0 && name.startsWith(packageValue)) { // if it does, we remove the package and the first dot. name = name.substring(packageValue.length() + 1); // look for how many segments we have left. // if one, just write it that way. // if more than one, write it with a leading dot. String[] packages = name.split(AdtConstants.RE_DOT); if (packages.length == 1) { text.setText(name); } else { text.setText("." + name); //$NON-NLS-1$ } } else { text.setText(name); } }
From source file:com.android.ide.eclipse.adt.internal.launch.junit.AndroidJUnitLaunchConfigurationTab.java
License:Open Source License
/** * Show a dialog that lists all main types *//*from ww w.j ava 2s. c o m*/ private void handleSearchButtonSelected() { Shell shell = getShell(); IJavaProject javaProject = getJavaProject(); IType[] types = new IType[0]; boolean[] radioSetting = new boolean[2]; try { // fix for Eclipse bug 66922 Wrong radio behaviour when switching // remember the selected radio button radioSetting[0] = mTestRadioButton.getSelection(); radioSetting[1] = mTestContainerRadioButton.getSelection(); types = TestSearchEngine.findTests(getLaunchConfigurationDialog(), javaProject, getTestKind()); } catch (InterruptedException e) { setErrorMessage(e.getMessage()); return; } catch (InvocationTargetException e) { AdtPlugin.log(e.getTargetException(), "Error finding test types"); //$NON-NLS-1$ return; } finally { mTestRadioButton.setSelection(radioSetting[0]); mTestContainerRadioButton.setSelection(radioSetting[1]); } SelectionDialog dialog = new TestSelectionDialog(shell, types); dialog.setTitle(JUnitMessages.JUnitLaunchConfigurationTab_testdialog_title); dialog.setMessage(JUnitMessages.JUnitLaunchConfigurationTab_testdialog_message); if (dialog.open() == Window.CANCEL) { return; } Object[] results = dialog.getResult(); if ((results == null) || (results.length < 1)) { return; } IType type = (IType) results[0]; if (type != null) { mTestText.setText(type.getFullyQualifiedName('.')); javaProject = type.getJavaProject(); mProjText.setText(javaProject.getElementName()); } }
From source file:com.android.ide.eclipse.editors.manifest.model.UiClassAttributeNode.java
License:Open Source License
private void handleNewType(IType type) { Text text = getTextWidget();//from ww w . j av a2s. c om // get the fully qualified name with $ to properly detect the enclosing types. String name = type.getFullyQualifiedName('$'); String packageValue = getManifestPackage(); // check if the class doesn't start with the package. if (packageValue.length() > 0 && name.startsWith(packageValue)) { // if it does, we remove the package and the first dot. name = name.substring(packageValue.length() + 1); // look for how many segments we have left. // if one, just write it that way. // if more than one, write it with a leading dot. String[] packages = name.split(AndroidConstants.RE_DOT); if (packages.length == 1) { text.setText(name); } else { text.setText("." + name); //$NON-NLS-1$ } } else { text.setText(name); } }
From source file:com.codenvy.ide.ext.java.server.core.search.TypeNameMatch.java
License:Open Source License
/** * Name of the type container using '.' character * as separator (e.g. package name + '.' + enclosing type names). * * @see #getType()//from www . jav a 2s. co m * @see org.eclipse.jdt.core.IMember#getDeclaringType() * * @throws NullPointerException if matched type is <code> null</code> * @return name of the type container */ public String getTypeContainerName() { IType outerType = getType().getDeclaringType(); if (outerType != null) { return outerType.getFullyQualifiedName('.'); } else { return getType().getPackageFragment().getElementName(); } }