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


Java IMarker.getAttribute方法代码示例

本文整理汇总了Java中org.eclipse.core.resources.IMarker.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java IMarker.getAttribute方法的具体用法?Java IMarker.getAttribute怎么用?Java IMarker.getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.resources.IMarker的用法示例。


在下文中一共展示了IMarker.getAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fix

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private void fix(IMarker marker, IProgressMonitor monitor) {
	MarkerResolutionGenerator.printAttributes (marker);
	try {
		String filepath  = (String) marker.getAttribute(BuildPolicyConfigurationException.JAVAFILENAME);
		int start = (int) marker.getAttribute(IMarker.CHAR_START);
		int end =  (int) marker.getAttribute(IMarker.CHAR_END);
		IFile ifile = (IFile) ResourceManager.toResource(new Path(filepath));
		ICompilationUnit cu = JavaCore.createCompilationUnitFrom(ifile);
		String source = cu.getBuffer().getContents();
		String part1 =  source.substring(0,start);
		String part2 =  source.substring(end);
		source = part1 + "value=\"" + resolutionMarkerDescription.getGenerator() + "\"" + part2;
		final Document document = new Document(source);
		cu.getBuffer().setContents(document.get());
	    cu.save(monitor, false);
	} catch (Exception e) {
		ResourceManager.logException(e);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:InvalidAnnotationPathGeneratorMarkerResolution.java

示例2: deleteAtomActionListener

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static ActionListener deleteAtomActionListener() {
  return new ActionListener() {
    @Override
    public void actionPerformed(final ActionEvent e) {
      final IMarker marker =
          Visualization.getMarker((AlloyAtom) Visualization.rightClickedAnnotation);
      final String sigTypeName = marker.getAttribute(MarkUtilities.MARKER_TYPE, "");
      final String relUri = marker.getAttribute(MarkUtilities.RELATIVE_URI, "");
      Display.getDefault().syncExec(new DeleteAtomCommand(marker));
      Visualization.showViz();
      AlloyOtherSolutionReasoning.getInstance().finish();
      for (final VisualizationChangeListener listener : VisualizationActionListenerFactory.listeners) {
        listener.onAtomRemoved(sigTypeName, relUri);
      }
    }
  };
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:VisualizationActionListenerFactory.java

示例3: findMarker

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private IMarker findMarker(IResource resource, String message, int lineNumber, String type) throws CoreException {
	IMarker[] marker = resource.findMarkers(type, true, IResource.DEPTH_ZERO);
	for (int i = 0; i < marker.length; i++) {
		IMarker currentMarker = marker[i];
		if (currentMarker == null) {
			continue;
		}
		Object lineNrAttribute = currentMarker.getAttribute(IMarker.LINE_NUMBER);
		String markerLineNumber = null;
		if (lineNrAttribute != null) {
			markerLineNumber = lineNrAttribute.toString();
		}
		Object messageAttribute = currentMarker.getAttribute(IMarker.MESSAGE);
		String markerMessage = null;
		if (messageAttribute != null) {
			markerMessage = messageAttribute.toString();
		}
		boolean sameMessageAndLineNr = SimpleStringUtils.equals(markerLineNumber, String.valueOf(lineNumber))
				&& SimpleStringUtils.equals(markerMessage, message);
		if (sameMessageAndLineNr) {
			return currentMarker;
		}
	}
	return null;
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:26,代码来源:AbstractMarkerHelper.java

示例4: removeMarkerForAbstractContextUsed

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
/**
 * @param project
 * @param file
 */
public static void removeMarkerForAbstractContextUsed (IFile file) {
	try {
		IMarker[] markers = file.findMarkers(GW4EBuilder.MARKER_TYPE, true, IResource.DEPTH_INFINITE);
		for (int i = 0; i < markers.length; i++) {
			IMarker m = markers[i];
			Integer pbId = (Integer)m.getAttribute(IJavaModelMarker.ID);
			if (pbId!=null) {
				if (GW4EParser.ABSTRACT_CONTEXT_USED==pbId.intValue()) {
					m.delete();
				}
			}
		}
	} catch (CoreException ce) {
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:GW4EBuilder.java

示例5: doRun

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
@Override
protected void doRun(IMarker marker,IProgressMonitor monitor) {
	try {
		String key = this.getEntryKey(marker);
		String value = p.getProperty(key);
		String pathGenerator = this.getPathGenerator(marker);
		 
		String sevonError = (String)marker.getAttribute(BuildPolicyConfigurationException.SEVERITY);
		if ((sevonError==null) || (sevonError.trim().length()==0)) {
			String temp = pathGenerator+";"+severity;
			value = value.replace(pathGenerator, temp);
		} else {
			value = value.replace(pathGenerator+";"+sevonError, pathGenerator+";"+severity);
		}
		setValue(key, value);
	} catch (Exception e) {
		ResourceManager.logException(e);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:InvalidSeverityMarkerResolution.java

示例6: createJimpleMarker

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private IMarker createJimpleMarker(IMarker marker) throws CoreException {
	String project = (String) marker.getAttribute("Jimple.project");
	String file = (String) marker.getAttribute("Jimple.file");
	IFile jimpleFile = getFile(project, file);

	IMarker jimpleMarker = null;
	IMarker[] markers = jimpleFile.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
	if(markers != null) {
		List<IMarker> jimpleBreakpoints = filterJimpleChildBreakpoints(Arrays.asList(markers));
		if(!jimpleBreakpoints.isEmpty()) {
			jimpleMarker = jimpleBreakpoints.get(0);
		} else {
			jimpleMarker = jimpleFile.createMarker(IBreakpoint.BREAKPOINT_MARKER);
		}
	} else {
		jimpleMarker = jimpleFile.createMarker(IBreakpoint.BREAKPOINT_MARKER);
	}

	jimpleMarker.setAttribute(IMarker.LINE_NUMBER, marker.getAttribute("Jimple." + IMarker.LINE_NUMBER));
	jimpleMarker.setAttribute("Jimple.unit.charStart", marker.getAttribute("Jimple.unit.charStart"));
	jimpleMarker.setAttribute("Jimple.unit.charEnd", marker.getAttribute("Jimple.unit.charEnd"));
	jimpleMarker.setAttribute("Jimple.unit.fqn", marker.getAttribute("Jimple.unit.fqn"));
	jimpleMarker.setAttribute("Jimple.project", marker.getAttribute("Jimple.project"));
	jimpleMarker.setAttribute("Jimple.file", marker.getAttribute("Jimple.file"));
	return jimpleMarker;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:27,代码来源:JimpleBreakpointManager.java

示例7: findContainer

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private Object findContainer(final String sigTypeName, final Map<Object, String> firstSides)
    throws TraceException {
  Set<String> containers = TraceManager.get().getContainerSigTypes(sigTypeName);
  for (Object object : firstSides.keySet()) {
    if (object instanceof IMarker) {
      IMarker iMarker = (IMarker) object;
      String markerType = iMarker.getAttribute(MarkUtilities.MARKER_TYPE, "");
      if (containers.contains(markerType))
        return iMarker;
    } else if (object instanceof String) {
      String atomName = (String) object;
      String type =
          atomName.contains("$") ? atomName.substring(0, atomName.indexOf("$")) : atomName;
      if (containers.contains(type))
        return type;
    }
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:20,代码来源:TraceObserver.java

示例8: jimpleBreakpointExists

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private boolean jimpleBreakpointExists() throws CoreException, BadLocationException {
	IMarker[] markers = getMarkersInFile();
	boolean markerPresent = false;
	for (IMarker item : markers) {
		int markerLineNumber = (int) item.getAttribute(IMarker.LINE_NUMBER);
		if (markerLineNumber == getLineNumber()) {
			markerPresent = true;
		}
	}
	return markerPresent;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:12,代码来源:ToggleJimpleBreakpointsTarget.java

示例9: getSourceList

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
/**
 * @param iMarker
 * @return If marker has not any source returns new ArrayList, else returns list of sourceF
 *         elements
 */
public static ArrayList<MarkElement> getSourceList(final IMarker iMarker) {
  ArrayList<MarkElement> sourceList = new ArrayList<>();
  try {
    if (iMarker.getAttribute(MarkUtilities.getSourceAttributeName()) != null) {
      sourceList = Serialization.getInstance()
          .fromString((String) iMarker.getAttribute(MarkUtilities.getSourceAttributeName()));
    }
  } catch (ClassNotFoundException | IOException | CoreException e) {
    e.printStackTrace();
  }
  return sourceList;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:MarkUtilities.java

示例10: getTargetList

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
/**
 * @param iMarker
 * @return If marker has not any target returns new ArrayList, else returns list of target
 *         elements
 */
public static ArrayList<MarkElement> getTargetList(final IMarker iMarker) {
  ArrayList<MarkElement> targetList = new ArrayList<>();
  try {
    if (iMarker.getAttribute(MarkUtilities.getTargetAttributeName()) != null) {
      targetList = Serialization.getInstance()
          .fromString((String) iMarker.getAttribute(MarkUtilities.getTargetAttributeName()));
    }
  } catch (ClassNotFoundException | IOException | CoreException e) {
    e.printStackTrace();
  }
  return targetList;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:MarkUtilities.java

示例11: getText

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
public static String getText(final IMarker iMarker) {
  try {
    return (String) iMarker.getAttribute(IMarker.TEXT);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:9,代码来源:MarkUtilities.java

示例12: loadBreakpoints

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private void loadBreakpoints(IResource project) {
	try {
		IMarker[] markers = project.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
		List<IMarker> methodBreakpoints = filterJavaMethodBreakpoints(markers);
		List<IMarker> jimpleChildBreakpoints = filterJimpleChildBreakpoints(methodBreakpoints);
		for (IMarker marker : jimpleChildBreakpoints) {
			String unitFqn = (String) marker.getAttribute("Jimple.unit.fqn");
			WorkspaceJob createBreakpoint = new WorkspaceJob("Create Jimple breakpoint") {
				@Override
				public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
					JimpleBreakpoint jimpleBreakpoint = getJimpleBreakpoint(unitFqn);
					if(jimpleBreakpoint == null) {
						IMarker jimpleMarker = createJimpleMarker(marker);
						jimpleBreakpoint = createBreakpointWithoutJavaBreakpoints(jimpleMarker);
						addBreakpoint(jimpleBreakpoint);
					}

					IBreakpoint javaBreakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
					jimpleBreakpoint.addJavaBreakpoint(javaBreakpoint);
					return Status.OK_STATUS;
				}
			};
			createBreakpoint.schedule();
		}
	} catch (CoreException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:30,代码来源:JimpleBreakpointManager.java

示例13: run

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
@Override
protected boolean run(IMarker marker, AbstractTextEditor editor, IDocument doc) {
	int start = marker.getAttribute(IMarker.CHAR_START, -1);
	int end = marker.getAttribute(IMarker.CHAR_END, -1);
	StyledText text = (StyledText) editor.getAdapter(Control.class);
	text.getDisplay().syncExec(() -> {
		MarkerUtils.applyEdits(doc, new ReplaceEdit(start, end - start, ""));
	});
	return true;
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:11,代码来源:TrimTrailingWhitespaceMarkerResolution.java

示例14: fix

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
private void fix(IMarker marker, IProgressMonitor monitor) {
	try {
		IPath graphModelPath = new Path ((String)marker.getAttribute(BuildPolicyConfigurationException.GRAPHMODELPATH));
		IFile ifile = (IFile) ResourceManager.toResource(graphModelPath);
		BuildPolicyManager.addDefaultPolicies(ifile,monitor);
		marker.delete();
	} catch (Exception e) {
		ResourceManager.logException(e);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:11,代码来源:MissingPoliciesForFileMarkerResolution.java

示例15: hasResolutions

import org.eclipse.core.resources.IMarker; //导入方法依赖的package包/类
@Override
public boolean hasResolutions(IMarker marker) {
	try {
		Object attr = marker.getAttribute(IJavaModelMarker.ID);
		return resolvers.get(attr) != null && resolvers.get(attr).length > 0;
	} catch (CoreException e) {
		return false;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:10,代码来源:MarkerResolutionGenerator.java


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