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


Java MarkerUtilities.createMarker方法代码示例

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


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

示例1: addSootAttributeMarkers

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
protected void addSootAttributeMarkers() {
	
	if (getAttrsHandler() == null)return;
	if (getAttrsHandler().getAttrList() == null) return;
	Iterator it = getAttrsHandler().getAttrList().iterator();
	HashMap markerAttr = new HashMap();
	
	while (it.hasNext()) {
		SootAttribute sa = (SootAttribute)it.next();
		if (((sa.getAllTextAttrs("<br>") == null) || (sa.getAllTextAttrs("<br>").length() == 0)) && 
			((sa.getAllLinkAttrs() == null) || (sa.getAllLinkAttrs().size() ==0))) continue;
		
		markerAttr.put(IMarker.LINE_NUMBER, new Integer(sa.getJavaStartLn()));
	
		try {
			MarkerUtilities.createMarker(getRec(), markerAttr, "ca.mcgill.sable.soot.sootattributemarker");
		}
		catch(CoreException e) {
			System.out.println(e.getMessage());
		}
	
	}

}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:25,代码来源:SootAttributesJavaHover.java

示例2: addSootAttributeMarkers

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
public void addSootAttributeMarkers(){//SootAttributesHandler handler, IFile rec) {
	
	if (getHandler().getAttrList() == null) return;
	Iterator it = getHandler().getAttrList().iterator();
	HashMap markerAttr = new HashMap();

	while (it.hasNext()) {
		SootAttribute sa = (SootAttribute)it.next();
		if (getHandler().isShowAllTypes() || typesContainsOneOf(sa.getAnalysisTypes())){
			if (((sa.getAllTextAttrs("") == null) || (sa.getAllTextAttrs("").length() == 0)) && 
				((sa.getAllLinkAttrs() == null) || (sa.getAllLinkAttrs().size() ==0))) continue;
			markerAttr.put(IMarker.LINE_NUMBER, new Integer(sa.getJimpleStartLn()));

			try {
				MarkerUtilities.createMarker(getRec(), markerAttr, "ca.mcgill.sable.soot.sootattributemarker");
			}
			catch(CoreException e) {
				System.out.println(e.getMessage());
			}
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:23,代码来源:SootAttrJimpleIconGenerator.java

示例3: addSootAttributeMarkers

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
public void addSootAttributeMarkers(){//SootAttributesHandler handler, IFile rec) {
	
	if (getHandler().getAttrList() == null) return;
	Iterator it = getHandler().getAttrList().iterator();
	HashMap markerAttr = new HashMap();

	while (it.hasNext()) {
		SootAttribute sa = (SootAttribute)it.next();
		if (getHandler().isShowAllTypes() || typesContainsOneOf(sa.getAnalysisTypes())) {
			if (((sa.getAllTextAttrs("<br>") == null) || (sa.getAllTextAttrs("<br>").length() == 0)) && 
				((sa.getAllLinkAttrs() == null) || (sa.getAllLinkAttrs().size() ==0))) continue;
			markerAttr.put(IMarker.LINE_NUMBER, new Integer(sa.getJavaStartLn()));
			try {
				MarkerUtilities.createMarker(getRec(), markerAttr, "ca.mcgill.sable.soot.sootattributemarker");
			}
			catch(CoreException e) {
				System.out.println(e.getMessage());
			}
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:22,代码来源:SootAttrJavaIconGenerator.java

示例4: createReferencingErrorMarkers

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
/**
 * Creates warning markers for undefined references. 
 * 
 * @param editor The editor to add the errors to
 * @param errors The errors to add as instances of <code>DocumentReference</code>
 */
public void createReferencingErrorMarkers(ITextEditor editor, List<DocumentReference> errors) {
    
    IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
    if (resource == null) return;
    IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    
    for (DocumentReference msg : errors) {
        try {
            int beginOffset = document.getLineOffset(msg.getLine() - 1) + msg.getPos();
            
            Map<String, ? super Object> map = new HashMap<String, Object>();
            map.put(IMarker.LINE_NUMBER, Integer.valueOf(msg.getLine()));
            map.put(IMarker.CHAR_START, Integer.valueOf(beginOffset));
            map.put(IMarker.CHAR_END, Integer.valueOf(beginOffset + msg.getLength()));
            map.put(IMarker.MESSAGE, "Key " + msg.getKey() + " is undefined");
            map.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_WARNING));
            
            MarkerUtilities.createMarker(resource, map, IMarker.PROBLEM);
        } catch (CoreException ce) {
            TexlipsePlugin.log("Creating marker", ce);
        } catch (BadLocationException ble) {
            TexlipsePlugin.log("Creating marker", ble);
        }
    }
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:32,代码来源:MarkerHandler.java

示例5: createMarker

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
/**
    * Create a layout warning marker to the given resource.
    *
    * @param resource the file where the problem occurred
    * @param message error message
    * @param lineNumber line number
    * @param markerType
    * @param severity Severity of the error
    */
   @SuppressWarnings("unchecked")
protected static void createMarker(IResource resource, 
   		Integer lineNumber, String message, String markerType, int severity) {
   	int lineNr = -1;
   	if (lineNumber != null) {
   		lineNr = lineNumber;
   	}
   	IMarker marker = AbstractProgramRunner.findMarker(resource, lineNr, message, markerType);
   	if (marker == null) {
   		try {
   			HashMap map = new HashMap();
   			map.put(IMarker.MESSAGE, message);
   			map.put(IMarker.SEVERITY, new Integer (severity));

   			if (lineNumber != null)
   				map.put(IMarker.LINE_NUMBER, lineNumber);

   			MarkerUtilities.createMarker(resource, map, markerType);
   		} catch (CoreException e) {
   			throw new RuntimeException(e);
   		}
   	}
   }
 
开发者ID:eclipse,项目名称:texlipse,代码行数:33,代码来源:AbstractProgramRunner.java

示例6: addMarker

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public static void addMarker(IFile file, String message, int line, int colPos, int markerType) {
	try {
		Map<String, Comparable> attributes = new HashMap<String, Comparable>(5);
		attributes.put(IMarker.SEVERITY, new Integer(markerType));
		attributes.put(IMarker.MESSAGE, message);
		attributes.put(IMarker.TEXT, message);
		if (colPos > 0) {
			attributes.put(IMarker.CHAR_START, new Integer(colPos));
			attributes.put(IMarker.CHAR_END, new Integer(colPos));
		}
		else {
			attributes.put(IMarker.LINE_NUMBER, new Integer(line));
		}
		MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
	} catch (Exception e) {}
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:18,代码来源:EditorUtil.java

示例7: addMarker

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
private void addMarker(RuleFailure ruleViolation) {
    try {
        Path path = new Path(ruleViolation.getName());
        IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);

        RuleFailurePosition startPosition = ruleViolation.getStartPosition();
        RuleFailurePosition endPosition = ruleViolation.getEndPosition();

        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put(IMarker.LINE_NUMBER, startPosition.getLine() + 1);
        attributes.put(IMarker.CHAR_START, startPosition.getPosition());
        attributes.put(IMarker.CHAR_END, endPosition.getPosition());
        attributes.put(IMarker.MESSAGE, ruleViolation.getFailure());
        attributes.put(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
        attributes.put(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);

        MarkerUtilities.createMarker(file, attributes, MARKER_TYPE);
    } catch (CoreException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:palantir,项目名称:eclipse-tslint,代码行数:22,代码来源:Linter.java

示例8: sendFeedback

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
@Override
	public void sendFeedback(FeedbackInstance feedbackInstance) {
		// Get all markers on the resource in question
		// place the marker
		Map<String, Object> map = new HashMap<String, Object>();
		map.put(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
		map.put(IMarker.MESSAGE, feedbackInstance.getMessage());
		map.put(IMarker.CHAR_START, feedbackInstance.getStartPosition());
		map.put(IMarker.CHAR_END, feedbackInstance.getEndPosition());
		
		try {
			MarkerUtilities.createMarker(contextModel.getResource(), map, "ESPSecurityPlugin.secproblem");
		} catch (CoreException e) {
//			LOG.log(Level.INFO, "Could not create marker: " + e.getMessage());
		}
	}
 
开发者ID:diarmaid-mcmanus,项目名称:ESPSecurityPlugin,代码行数:17,代码来源:EclipseMarkerFeedbackReporter.java

示例9: addMarker

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
public void addMarker(int markerSeverity, String Marker,IFile file, String message, Integer lineNumber, Integer beginChar, Integer endChar, String msgGroup) {
	try {
		HashMap<String, java.lang.Object> datas = new HashMap<String, java.lang.Object>();
        datas.put( IMarker.MESSAGE, message != null ? message : "<null>" );
        datas.put( IMarker.SEVERITY, markerSeverity );
        
        if ( beginChar != null )
        	datas.put( IMarker.CHAR_START, beginChar );
        else
        	datas.put( IMarker.CHAR_START, 0 );
 
        if ( endChar != null )
           	datas.put( IMarker.CHAR_END, endChar );
       	else
       		datas.put( IMarker.CHAR_END, 0 );
        if(lineNumber != null)
        	datas.put(IMarker.LINE_NUMBER, lineNumber);
        datas.put(KERMETA_MARKER_ATTRIBUTE, msgGroup);
        MarkerUtilities.createMarker( file, datas, IMarker.PROBLEM );
	/*
		IMarker marker = file.createMarker(Marker);
		marker.setAttribute(IMarker.MESSAGE, message != null ? message : "<null>");
		marker.setAttribute(IMarker.SEVERITY, markerSeverity);
		if (lineNumber == -1) {
			lineNumber = 1;
		}
		marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
		marker.setAttribute(IMarker.CHAR_START, beginChar);
		marker.setAttribute(IMarker.CHAR_END, endChar);
		marker.setAttribute(KERMETA_MARKER_ATTRIBUTE, msgGroup);
	*/
	} catch (CoreException e) {
		ms.log(Kind.DevERROR, "Failed to mark TextFile", Activator.PLUGIN_ID, e);
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:36,代码来源:EclipseReporter.java

示例10: createMarkers

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
/**
 * Creates markers from a given list of <code>ParseErrorMessage</code>s.
 * 
 * @param editor The editor to add the errors to
 * @param markers The markers to add as instances of <code>ParseErrorMessage</code>
 * @param markerType The type of the markers as <code>IMarker</code> types
 */
private void createMarkers(ITextEditor editor, List<ParseErrorMessage> markers, final String markerType) {
    IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
    if (resource == null) return;
    //IResource resource = ((FileEditorInput)editor.getEditorInput()).getFile();
    IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    
    for (ParseErrorMessage msg : markers) {
        try {
            int beginOffset = document.getLineOffset(msg.getLine() - 1) + msg.getPos();
            
            Map<String, ? super Object> map = new HashMap<String, Object>();
            map.put(IMarker.LINE_NUMBER, Integer.valueOf(msg.getLine()));
            map.put(IMarker.CHAR_START, Integer.valueOf(beginOffset));
            map.put(IMarker.CHAR_END, Integer.valueOf(beginOffset + msg.getLength()));
            map.put(IMarker.MESSAGE, msg.getMsg());
            
            // we can do this since we're referring to a static field
            if (IMarker.PROBLEM == markerType)
                map.put(IMarker.SEVERITY, Integer.valueOf(msg.getSeverity()));
            
            if (IMarker.TASK == markerType)
                map.put(IMarker.PRIORITY, Integer.valueOf(msg.getSeverity()));
            
            MarkerUtilities.createMarker(resource, map, markerType);
        } catch (CoreException ce) {
            TexlipsePlugin.log("Creating marker", ce);
        } catch (BadLocationException ble) {
            TexlipsePlugin.log("Creating marker", ble);
        }
    }
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:39,代码来源:MarkerHandler.java

示例11: addFatalError

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
/**
 * Adds a fatal error to the problem log.
 * 
 * @param editor The editor to add the errors to
 * @param error The error message 
 */
public void addFatalError(ITextEditor editor, String error) {
    IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
    if (resource == null) return;
    //IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    try {
        Map<String, ? super Object> map = new HashMap<String, Object>();
        map.put(IMarker.MESSAGE, error);
        map.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_ERROR));
        
        MarkerUtilities.createMarker(resource, map, IMarker.PROBLEM);
    } catch (CoreException ce) {
        TexlipsePlugin.log("Creating marker", ce);
    }
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:21,代码来源:MarkerHandler.java

示例12: createErrorMarker

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
/**
 * Creates an error marker on the given line
 * 
 * @param resource The resource to create the error to
 * @param message The message for the marker
 * @param lineNumber The line number to create the error on
 */
public void createErrorMarker(IResource resource, String message, int lineNumber) {
    try {
        Map<String, ? super Object> map = new HashMap<String, Object>();
        map.put(IMarker.LINE_NUMBER, Integer.valueOf(lineNumber));
        map.put(IMarker.MESSAGE, message);
        
        map.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_ERROR));
        
        MarkerUtilities.createMarker(resource, map, IMarker.PROBLEM);
    } catch (CoreException ce) {
        TexlipsePlugin.log("Creating marker", ce);
    }
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:21,代码来源:MarkerHandler.java

示例13: createMarkerForResource

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
/**
 * Creates a 'red cross' flag on the given file, at the line number specified, with the
 * hover-message specificed.
 * 
 * Remember that linenumber starts at 1!
 */
public static void createMarkerForResource(IResource resource, int linenumber, String message)
    throws CoreException {

  if (linenumber == 0) {
    linenumber = 1;
  }
  HashMap<String, Object> map = new HashMap<String, Object>();
  MarkerUtilities.setLineNumber(map, linenumber);
  MarkerUtilities.setMessage(map, message);
  map.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
  MarkerUtilities.createMarker(resource, map, IMarker.PROBLEM);
}
 
开发者ID:joereddington,项目名称:EclipseEditorPluginExample,代码行数:19,代码来源:EditorActions.java

示例14: createParserErrorMarkers

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
/**
 * Adds the error markers for some error that was found in the parsing process.
 *
 * @param error the error find while parsing the document
 * @param resource the resource that should have the error added
 * @param doc the document with the resource contents
 * @return the error description (or null)
 *
 * @throws BadLocationException
 * @throws CoreException
 */
public static ErrorDescription createParserErrorMarkers(Throwable error, IAdaptable resource, IDocument doc) {
    ErrorDescription errDesc;
    errDesc = createErrorDesc(error, doc);

    //Create marker only if possible...
    if (resource != null) {
        IResource fileAdapter = resource.getAdapter(IResource.class);
        if (fileAdapter != null) {
            try {
                Map<String, Object> map = new HashMap<String, Object>();

                map.put(IMarker.MESSAGE, errDesc.message);
                map.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
                map.put(IMarker.LINE_NUMBER, errDesc.errorLine);
                map.put(IMarker.CHAR_START, errDesc.errorStart);
                map.put(IMarker.CHAR_END, errDesc.errorEnd);
                map.put(IMarker.TRANSIENT, true);
                MarkerUtilities.createMarker(fileAdapter, map, IMarker.PROBLEM);
            } catch (Exception e) {
                Log.log(e);
            }
        }
    }

    return errDesc;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:38,代码来源:PyParser.java

示例15: updateSourcesToDelete

import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
public static void updateSourcesToDelete(final IMarker beDeleted) {
  try {
    if (MarkUtilities.getSourceList(beDeleted).size() != 0) {
      final ArrayList<MarkElement> sourceElements = MarkUtilities.getSourceList(beDeleted);

      for (final MarkElement sourceElement : sourceElements) {

        final IMarker sourceMarker = sourceElement.getiMarker();
        List<IMarker> groupSourceMarkers = new ArrayList<IMarker>();

        if (MarkUtilities.getGroupId(sourceMarker) != null) {
          groupSourceMarkers = MarkerFactory.findMarkersByGroupId(sourceMarker.getResource(),
              MarkUtilities.getGroupId(sourceMarker));
        }
        if (groupSourceMarkers.isEmpty()) {
          groupSourceMarkers.add(sourceMarker);
        }

        for (final IMarker groupSourceMarker : groupSourceMarkers) {

          if (MarkUtilities.getTargetList(groupSourceMarker).size() != 0) {
            final ArrayList<MarkElement> targetElementsofSource =
                MarkUtilities.getTargetList(groupSourceMarker);

            for (int i = targetElementsofSource.size() - 1; i >= 0; i--) {
              if (MarkUtilities.compare(targetElementsofSource.get(i).getiMarker(), beDeleted)) {
                targetElementsofSource.remove(i);
              }
            }
            MarkUtilities.setTargetList(groupSourceMarker, targetElementsofSource);

            if (groupSourceMarker.getType().equals(MarkerFactory.MARKER_MAPPING)
                && targetElementsofSource.size() == 0) {
              // final IEditorPart part =
              IDE.openEditor(MarkerActivator.getActiveWorkbenchWindow().getActivePage(),
                  groupSourceMarker, false);
              final Map<String, Object> attributes = groupSourceMarker.getAttributes();
              final IResource res = groupSourceMarker.getResource();
              AnnotationFactory.removeAnnotation(groupSourceMarker);
              groupSourceMarker.delete();
              MarkerUtilities.createMarker(res, attributes, MarkerFactory.MARKER_MARKING);
              final IMarker newMarker = MarkerFactory.findMarkerBySourceId(res,
                  (String) attributes.get(IMarker.SOURCE_ID));
              AnnotationFactory.addAnnotation(newMarker, AnnotationFactory.ANNOTATION_MARKING);
            }
          }
        }
      }
    }
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:54,代码来源:MarkerUpdater.java


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