当前位置: 首页>>代码示例>>Java>>正文


Java IMethod.exists方法代码示例

本文整理汇总了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;
		}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:24,代码来源:ITypeWidgetExtension.java

示例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);
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:33,代码来源:LaunchCommand.java

示例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());
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:35,代码来源:LaunchPipelineShortcut.java

示例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());
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:11,代码来源:GetterSetterUtil.java


注:本文中的org.eclipse.jdt.core.IMethod.exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。