本文整理汇总了Java中org.eclipse.jdt.core.IMethod.exists方法的典型用法代码示例。如果您正苦于以下问题:Java IMethod.exists方法的具体用法?Java IMethod.exists怎么用?Java IMethod.exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IMethod
的用法示例。
在下文中一共展示了IMethod.exists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFigure
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
@Override
public IFigure createFigure(IObjectModel e) {
Label label = new Label();
label.setForegroundColor(PandionJConstants.Colors.OBJECT_HEADER_FONT);
FontManager.setFont(label, PandionJConstants.OBJECT_HEADER_FONT_SIZE);
IType type = e.getType();
if(type != null) {
IMethod method = type.getMethod("toString", new String[0]);
if(!method.exists()) {
label.setText(":" + type.getElementName());
return label;
}
}
invokeToString(e, label);
label.setToolTip(new Label("returned by toString()"));
e.getRuntimeModel().registerDisplayObserver((event) -> {
if(event.type == IRuntimeModel.Event.Type.STEP ||event.type == IRuntimeModel.Event.Type.EVALUATION) {
invokeToString(e, label);
// label.setText(e.getStringValue());
}
});
return label;
}
示例2: launch
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private void launch(IResource file, int line, IType type, String agentArgs, IMethod mainMethod)
throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType confType = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy wc = confType.newInstance(null, file.getName() + " (PandionJ)");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, file.getProject().getName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, type.getFullyQualifiedName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, false);
// if(breakPoint != null)
// breakPoint.delete();
// if(line != -1)
// breakPoint = JDIDebugModel.createLineBreakpoint(file, firstType.getFullyQualifiedName(), line, -1, -1, 0, true, null);
try {
Bundle bundle = Platform.getBundle(LaunchCommand.class.getPackage().getName());
URL find = FileLocator.find(bundle, new Path("lib/agent.jar"), null);
URL resolve = FileLocator.resolve(find);
if(!mainMethod.exists()) {
String path = resolve.getPath();
if(Platform.getOS().compareTo(Platform.OS_WIN32) == 0)
path = path.substring(1);
String args = "-javaagent:\"" + path + "=" + agentArgs + "\" -Djava.awt.headless=true";
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, args);
}
} catch (IOException e1) {
e1.printStackTrace();
}
ILaunchConfiguration config = wc.doSave();
Activator.launch(config);
}
示例3: launchNew
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private void launchNew(LaunchableResource resource, String mode) {
try {
ILaunchManager launchManager = getLaunchManager();
String launchConfigurationName =
launchManager.generateLaunchConfigurationName(resource.getLaunchName());
ILaunchConfigurationType configurationType =
getDataflowLaunchConfigurationType(launchManager);
ILaunchConfigurationWorkingCopy configuration =
configurationType.newInstance(null, launchConfigurationName);
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
resource.getProjectName());
IMethod mainMethod = resource.getMainMethod();
if (mainMethod != null && mainMethod.exists()) {
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
mainMethod.getDeclaringType().getFullyQualifiedName());
}
String groupIdentifier =
mode.equals(ILaunchManager.RUN_MODE) ? IDebugUIConstants.ID_RUN_LAUNCH_GROUP
: IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP;
int returnStatus =
DebugUITools.openLaunchConfigurationDialog(DataflowUiPlugin.getActiveWindowShell(),
configuration, groupIdentifier, null);
if (returnStatus == Window.OK) {
configuration.doSave();
}
} catch (CoreException e) {
// TODO: Handle
DataflowUiPlugin.logError(e, "Error while launching new Launch Configuration for project %s",
resource.getProjectName());
}
}
示例4: getGetter
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
public static IMethod getGetter(IField field) throws JavaModelException {
String getterName = getGetterName(field, EMPTY, true);
IMethod primaryCandidate = JavaModelUtil.findMethod(getterName, new String[0], false, field.getDeclaringType());
if (!JavaModelUtil.isBoolean(field) || (primaryCandidate != null && primaryCandidate.exists())) {
return primaryCandidate;
}
//bug 30906 describes why we need to look for other alternatives here (try with get... for booleans)
String secondCandidateName = getGetterName(field, EMPTY, false);
return JavaModelUtil.findMethod(secondCandidateName, new String[0], false, field.getDeclaringType());
}