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


Java IMarker.delete方法代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:27,代码来源:SiriusEditorUtils.java

示例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) {
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:GW4EBuilder.java

示例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);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:11,代码来源:SetNoCheckPoliciesForFileMarkerResolution.java

示例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();
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:BuildInstruction.java

示例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();

	}
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:36,代码来源:UnpersistedMarkerHelper.java

示例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) {
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:15,代码来源:GW4EBuilder.java

示例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);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:11,代码来源:SetSyncPoliciesForFileMarkerResolution.java

示例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);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:11,代码来源:MissingPoliciesForFileMarkerResolution.java

示例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();
		}
	}
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:MasterViewDeleteHandler.java

示例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();
		}
	}
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:10,代码来源:ToggleJimpleBreakpointsTarget.java

示例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();
	}
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:8,代码来源:JavaBreakpointListener.java

示例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);
		}
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:43,代码来源:MissingBuildPoliciesFileMarkerResolution.java

示例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();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:56,代码来源:DeleteAllHandler.java

示例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();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:54,代码来源:MarkerUpdater.java

示例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();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:48,代码来源:DeleteAtomCommand.java


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