本文整理匯總了Java中org.eclipse.core.resources.IMarker.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java IMarker.delete方法的具體用法?Java IMarker.delete怎麽用?Java IMarker.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.IMarker
的用法示例。
在下文中一共展示了IMarker.delete方法的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);
}
}
}
示例2: 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) {
}
}
示例3: 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.addNoCheckPolicies(ifile,monitor);
marker.delete();
} catch (Exception e) {
ResourceManager.logException(e);
}
}
示例4: deleteObsoleteResources
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void deleteObsoleteResources(final String uri, IProgressMonitor progressMonitor) throws CoreException {
SubMonitor deleteMonitor = SubMonitor.convert(progressMonitor, derivedResources.size());
for (IFile iFile : newLinkedHashSet(derivedResources)) {
IMarker marker = derivedResourceMarkers.findDerivedResourceMarker(iFile, uri);
if (marker != null)
marker.delete();
if (derivedResourceMarkers.findDerivedResourceMarkers(iFile).length == 0) {
for (String outputName : outputConfigurations.keySet()) {
access.deleteFile(iFile, outputName, deleteMonitor);
}
needRebuild();
}
}
}
示例5: removeAllRegisteredMarkers
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
/**
* Removes all created error markers
*
* @throws CoreException
*/
public void removeAllRegisteredMarkers() throws CoreException {
List<IMarker> workingCopy = new ArrayList<>(markerRegistry);
for (IMarker marker : workingCopy) {
String type = null;
boolean markerExists = marker.exists();
if (markerExists){
try {
type = marker.getType();
} catch (CoreException e) {
markerExists=false;
}
if (IMarker.TASK.equals(type)) {
/* tasks are not deleted */
continue;
}
}
markerRegistry.remove(marker);
if (!markerExists) {
/*
* means marker.getType() failed, because marker does not exist
* any more. This can happen when a marker is removed manually on ui.
*/
continue;
}
marker.delete();
}
}
示例6: deleteMarkers
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
/**
* Delete the markers for this project
* @param file
*/
private void deleteMarkers(IProject project) {
try {
IMarker[] markers = project.findMarkers(GW4EBuilder.MARKER_TYPE, true, IResource.DEPTH_INFINITE);
for (int i = 0; i < markers.length; i++) {
IMarker m = markers[i];
m.delete();
}
} catch (CoreException ce) {
}
}
示例7: 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.addSyncPolicies(ifile,monitor);
marker.delete();
} catch (Exception e) {
ResourceManager.logException(e);
}
}
示例8: 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);
}
}
示例9: deleteSelections
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void deleteSelections() {
for (final IMarker iMarker : this.delCandidates) {
this.deleteFromAlloyXML(iMarker);
AnnotationFactory.removeAnnotation(iMarker);
try {
iMarker.delete();
} catch (final CoreException e) {
e.printStackTrace();
}
}
}
示例10: deleteJimpleBreakpoint
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void deleteJimpleBreakpoint() throws CoreException, BadLocationException {
IMarker[] markers = getMarkersInFile();
for (IMarker item : markers) {
int markerLineNumber = (int) item.getAttribute(IMarker.LINE_NUMBER);
if (markerLineNumber == getLineNumber()) {
item.delete();
}
}
}
示例11: removeOldInstructionPointer
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void removeOldInstructionPointer(String project) throws CoreException {
IProject currentProject = ResourcesPlugin.getWorkspace().getRoot().getProject(project);
IMarker[] instructionPointers = currentProject.findMarkers(JIMPLE_INSTRUCTIONPOINTER_MARKER, false, IResource.DEPTH_INFINITE);
for (IMarker m : instructionPointers) {
m.delete();
}
}
示例12: fix
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void fix(IMarker marker,IWorkbenchWindow ww,IProgressMonitor monitor) {
IResource resource = marker.getResource();
if (resource instanceof IFile) {
try {
IFile file = (IFile) resource;
buildFile = BuildPolicyManager.createBuildPoliciesFile(file,monitor);
marker.delete();
// remove all markers with this problem. The above
// resolution fixes also all others of the same type
IProject project = file.getProject();
IMarker[] markers = project.findMarkers(GW4EBuilder.MARKER_TYPE, true, IResource.DEPTH_INFINITE);
IContainer container = file.getParent();
for (int i = 0; i < markers.length; i++) {
IMarker m = markers[i];
IResource r = m.getResource();
if (r instanceof IFile) {
IFile f = (IFile) resource;
IContainer c = f.getParent();
if (c.equals(container) && m.exists()) {
Object attr = m.getAttribute(IJavaModelMarker.ID);
Integer pbid = (Integer) attr;
if (pbid == null)
continue;
if (pbid.equals(GW4EParser.MISSING_BUILD_POLICIES_FILE)) {
m.delete();
}
}
}
}
Display.getDefault().syncExec(new Runnable () {
@Override
public void run() {
JDTManager.openEditor(buildFile, ww);
ResourceManager.touchFolderResources(file);
}
});
} catch (Exception e) {
ResourceManager.logException(e);
}
}
}
示例13: deleteMarkers
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void deleteMarkers() {
this.editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
this.file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor().getEditorInput().getAdapter(IFile.class);
this.selection =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
try {
final IMarker beDeleted = this.getMarker();
if (beDeleted != null && beDeleted.exists()) {
final MessageDialog warningDialog =
new MessageDialog(MarkerActivator.getShell(), "Warning!", null,
"If you delete markers, all relations of these markers has been removed! Do you want to continue to delete markers?",
MessageDialog.WARNING, new String[] {"YES", "NO"}, 0);
if (warningDialog.open() != 0) {
return;
}
this.findCandidateToTypeChangingMarkers(beDeleted);
final String sourceIdOfSelectedMarker = MarkUtilities.getSourceId(beDeleted);
for (final IMarker iMarker : this.candidateToTypeChanging) {
AnnotationFactory.convertAnnotationType(iMarker, true,
MarkUtilities.compare(MarkUtilities.getSourceId(iMarker), sourceIdOfSelectedMarker),
AlloyUtilities.getTotalTargetCount(iMarker));
}
final String markerText = MarkUtilities.getText(beDeleted);
if (MarkUtilities.getGroupId(beDeleted) != null) {
final String markerGroupId = MarkUtilities.getGroupId(beDeleted);
final List<IMarker> markers =
MarkerFactory.findMarkersByGroupId(this.file, markerGroupId);
for (int i = markers.size() - 1; i >= 0; i--) {
this.deleteFromAlloyXML(markers.get(i));
AnnotationFactory.removeAnnotation(markers.get(i));
markers.get(i).delete();
}
} else {
this.deleteFromAlloyXML(beDeleted);
AnnotationFactory.removeAnnotation(beDeleted);
beDeleted.delete();
}
final MessageDialog dialog =
new MessageDialog(MarkerActivator.getShell(), "Mark will be deleted by this wizard",
null, "\"" + markerText + "\" has been selected to be unmarked",
MessageDialog.INFORMATION, new String[] {"OK"}, 0);
dialog.open();
}
} catch (final CoreException e) {
e.printStackTrace();
}
}
示例14: updateSourcesToDelete
import org.eclipse.core.resources.IMarker; //導入方法依賴的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();
}
}
示例15: deleteMarker
import org.eclipse.core.resources.IMarker; //導入方法依賴的package包/類
private void deleteMarker() {
try {
final IMarker beDeleted = marker;
if (beDeleted != null && beDeleted.exists()) {
final MessageDialog warningDialog =
new MessageDialog(Activator.getShell(), "Warning!", null,
"If you delete marker, all relations of this marker has been removed! Do you want to continue to delete marker?",
MessageDialog.WARNING, new String[] {"YES", "NO"}, 0);
if (warningDialog.open() != 0) {
return;
}
findCandidateToTypeChangingMarkers(beDeleted);
final String sourceIdOfSelectedMarker = MarkUtilities.getSourceId(beDeleted);
for (final IMarker iMarker : candidateToTypeChanging) {
AnnotationFactory.convertAnnotationType(iMarker, true,
MarkUtilities.compare(MarkUtilities.getSourceId(iMarker), sourceIdOfSelectedMarker),
AlloyUtilities.getTotalTargetCount(iMarker));
}
final String markerText = MarkUtilities.getText(beDeleted);
if (MarkUtilities.getLeaderId(beDeleted) != null) {
final String markerGroupId = MarkUtilities.getGroupId(beDeleted);
final List<IMarker> markers =
MarkerFactory.findMarkersByGroupId(beDeleted.getResource(), markerGroupId);
for (int i = markers.size() - 1; i >= 0; i--) {
deleteFromAlloyXML(markers.get(i));
AnnotationFactory.removeAnnotation(markers.get(i));
markers.get(i).delete();
}
} else {
deleteFromAlloyXML(beDeleted);
AnnotationFactory.removeAnnotation(beDeleted);
beDeleted.delete();
}
final MessageDialog dialog =
new MessageDialog(Activator.getShell(), "Mark will be deleted by this wizard", null,
"\"" + markerText + "\" has been selected to be unmarked",
MessageDialog.INFORMATION, new String[] {"OK"}, 0);
dialog.open();
}
} catch (final CoreException e) {
e.printStackTrace();
}
}