當前位置: 首頁>>代碼示例>>Java>>正文


Java IMarker.setAttribute方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IMarker.setAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java IMarker.setAttribute方法的具體用法?Java IMarker.setAttribute怎麽用?Java IMarker.setAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IMarker的用法示例。


在下文中一共展示了IMarker.setAttribute方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showInstruction

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
/**
 * Show the given {@link EObject instruction}.
 * 
 * @param editorPart
 *            the opened {@link DialectEditor}
 * @param instruction
 *            the {@link EObject instruction} to show
 */
public static void showInstruction(DialectEditor editorPart, EObject instruction) {
	final URI resourceURI = instruction.eResource().getURI();
	if (resourceURI.isPlatformResource()) {
		final String resourcePath = resourceURI.toPlatformString(true);
		final IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
				resourcePath));
		try {
			final IMarker marker = resource.createMarker(EValidator.MARKER);
			marker.setAttribute(EValidator.URI_ATTRIBUTE, EcoreUtil.getURI(instruction).toString());
			final TraceabilityMarkerNavigationProvider navigationProvider = new TraceabilityMarkerNavigationProvider(
					(DialectEditor)editorPart);
			navigationProvider.gotoMarker(marker);
			marker.delete();
		} catch (CoreException e) {
			DebugSiriusIdeUiPlugin.INSTANCE.log(e);
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:27,代碼來源:SiriusEditorUtils.java

示例2: 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

示例3: addMarker

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
/**
 * Add a marker in the problem view for the passed file
 * 
 * @param file
 * @param e
 * @param severity
 * @param problemid
 * @throws CoreException
 */
public static void addMarker(IFile file, Object owner, ParserException e, int severity) {
	try {
		IMarker marker = file.createMarker(GW4EBuilder.MARKER_TYPE);
		marker.setAttribute(IMarker.MESSAGE, e.getMessage());
		marker.setAttribute(IMarker.SEVERITY, severity);
		marker.setAttribute(IJavaModelMarker.ID, e.getProblemId());
		marker.setAttribute(IMarker.CHAR_START, e.getStart());
		marker.setAttribute(IMarker.CHAR_END, e.getEnd());
		marker.setAttribute(IMarker.LINE_NUMBER, e.getLineNumber());
		marker.setAttribute(IMarker.SOURCE_ID, owner.getClass().getName());
		Properties p = e.getAttributes();
		Iterator iter = p.keySet().iterator();
		while (iter.hasNext()) {
			String key = (String) iter.next();
			marker.setAttribute(key, p.get(key));
		}
	} catch (Exception e1) {
		ResourceManager.logException(e1);
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:30,代碼來源:MarkerManager.java

示例4: updateMarker

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void updateMarker(IResource resource, String message, int start, int end, int severity,
		IMarker marker) {
	try {
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.SEVERITY, severity);
		if (resource.getType() != IResource.FILE) {
			return;
		}
		IFile file = (IFile) resource;
		ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
		ITextFileBuffer textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);

		if (textFileBuffer == null) {
			manager.connect(file.getFullPath(), LocationKind.IFILE, new NullProgressMonitor());
			textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
		}

		IDocument document = textFileBuffer.getDocument();

		marker.setAttribute(IMarker.CHAR_START, start);
		marker.setAttribute(IMarker.CHAR_END, end);
		marker.setAttribute(IMarker.LINE_NUMBER, document.getLineOfOffset(start) + 1);
	} catch (CoreException | BadLocationException e) {
		e.printStackTrace();
	}
}
 
開發者ID:angelozerr,項目名稱:ec4e,代碼行數:27,代碼來源:ValidateEditorConfigStrategy.java

示例5: createMarker

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
@Override
public void createMarker(Resource res, String message, Severity severity) {

	final int severityEclipse;
	switch (severity) {
	case INFO:
		severityEclipse = IMarker.SEVERITY_INFO;
		break;
	case WARNING:
		severityEclipse = IMarker.SEVERITY_WARNING;
		break;
	default:
		severityEclipse = IMarker.SEVERITY_ERROR;
		break;
	}

	try {
		IMarker marker = toIFile(res).createMarker(MARKER__ORG_ECLIPSE_IDE_N4JS_UI_COMPILER_ERROR);
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.SEVERITY, severityEclipse);
		marker.setAttribute(IMarker.LINE_NUMBER, 1);
	} catch (CoreException e) {
		LOGGER.error(e.getStatus());
		String resInfo = "";
		if (res != null) {
			if (res.getURI() != null) {
				resInfo = "on resource with uri=" + res.getURI();
			} else {
				resInfo = "on resource=" + res;
			}
		}
		throw new RuntimeException("Cannot create error marker with message='" + message + "' " + resInfo + ".", e);
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:35,代碼來源:GeneratorMarkerSupport.java

示例6: processMarkers

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void processMarkers() {
	try {
		for (MarkerInfo mi: pendingMarkers) {
			IMarker marker = mi.file.createMarker(MARKER_TYPE);
			marker.setAttribute(IMarker.MESSAGE, mi.message);
			marker.setAttribute(IMarker.SEVERITY, mi.severity);
			if (mi.lineNumber == -1) {
				mi.lineNumber = 1;
			}
			marker.setAttribute(IMarker.LINE_NUMBER, mi.lineNumber);
		}
		pendingMarkers.clear();
	} catch (CoreException e) {
	}
}
 
開發者ID:mnlipp,項目名稱:EclipseMinifyBuilder,代碼行數:16,代碼來源:MinifyBuilder.java

示例7: setXpath

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
public static String setXpath(final IMarker iMarker, final String xPath) {
  try {
    iMarker.setAttribute("xpath", xPath);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:9,代碼來源:MarkUtilities.java

示例8: reportError

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void reportError(IResource resource, String message)
{
	try
	{
		IMarker marker = resource.createMarker(JPFClasspathPlugin.MARKER_ID);
		marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.LINE_NUMBER, 1);
	}
	catch( CoreException e )
	{
		// nothing
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:15,代碼來源:JPFManifestBuilder.java

示例9: setText

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
public static void setText(final IMarker iMarker, final String text) {
  try {
    iMarker.setAttribute(IMarker.TEXT, text);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:8,代碼來源:MarkUtilities.java

示例10: setUri

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
public static void setUri(final IMarker iMarker, final String uri) {
  try {
    iMarker.setAttribute(URI, uri);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:8,代碼來源:MarkUtilities.java

示例11: setGroupId

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
public static void setGroupId(final IMarker iMarker, final String groupId) {
  try {
    iMarker.setAttribute(MarkUtilities.GROUP_ID, groupId);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:8,代碼來源:MarkUtilities.java

示例12: createBreakpointMarkerForNextUnit

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private IMarker createBreakpointMarkerForNextUnit(UnitLocation location, IMarker marker) throws CoreException, IOException {
	IFile file = location.project.getFile(location.jimpleFile);
	IMarker m = file.createMarker(marker.getType());
	m.setAttribute("Jimple.breakpoint.type", "unit");
	m.setAttribute(IMarker.LINE_NUMBER, location.line);
	m.setAttribute("Jimple.file", file.getProjectRelativePath().toString());
	m.setAttribute("Jimple.project", marker.getAttribute("Jimple.project"));
	m.setAttribute("Jimple.unit.charStart", location.charStart);
	m.setAttribute("Jimple.unit.charEnd", location.charEnd);
	m.setAttribute("Jimple.unit.fqn", location.vfUnit.getFullyQualifiedName());
	m.setAttribute("Jimple.temporary", true);
	return m;
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:14,代碼來源:JimpleBreakpointManager.java

示例13: setLinenumber

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
public static void setLinenumber(final IMarker iMarker, final int linenumber) {
  try {
    iMarker.setAttribute(IMarker.LOCATION, linenumber);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:8,代碼來源:MarkUtilities.java

示例14: createJimpleBreakpoint

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void createJimpleBreakpoint() throws CoreException, BadLocationException {
	IDocument document = getDocument();
	IFile file = getFile();
	int lineNumber = getLineNumber();

	int offset = document.getLineOffset(lineNumber - 1);
	int length = document.getLineInformation(lineNumber - 1).getLength();
	int charStart = offset;
	int charEnd = offset + length;
	try {
		String unitFqn = getUnitFqn(lineNumber - 1, offset, length);

		IMarker m = file.createMarker(JIMPLE_BREAKPOINT_MARKER);
		m.setAttribute(IMarker.LINE_NUMBER, getLineNumber());
		m.setAttribute(IMarker.MESSAGE, "Unit breakpoint: " + file.getName() + " [Line "+getLineNumber()+"]");
		m.setAttribute("Jimple.file", file.getProjectRelativePath().toPortableString());
		m.setAttribute("Jimple.project", file.getProject().getName());
		m.setAttribute("Jimple.unit.charStart", charStart);
		m.setAttribute("Jimple.unit.charEnd", charEnd);
		m.setAttribute("Jimple.unit.fqn", unitFqn);

		JimpleBreakpointManager.getInstance().createBreakpoint(m);
	} catch(UnitNotFoundException e) {
		String msg = "The selected unit couldn't be found in our Jimple model. This might be a problem related to Jimple optimizations.";
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Breakpoint could not be placed", msg);
	}
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:28,代碼來源:ToggleJimpleBreakpointsTarget.java

示例15: setSourceId

import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
public static void setSourceId(final IMarker imarker, final String id) {
  try {
    imarker.setAttribute(IMarker.SOURCE_ID, id);
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:8,代碼來源:MarkUtilities.java


注:本文中的org.eclipse.core.resources.IMarker.setAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。