本文整理匯總了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());
}