當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。