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


Java BadLocationException.printStackTrace方法代码示例

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


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

示例1: reconcile

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
@Override
public void reconcile(final IRegion partition) {
  if (this.document == null) {
    return;
  }
  try {
    final ITypedRegion[] partitionRegions =
        this.document.computePartitioning(partition.getOffset(), partition.getLength());
    for (int i = 0; i < partitionRegions.length; i++) {
      if (partitionRegions[i].getType().equals(MetaModelPartitionScanner.META_MODEL_REASON)) {
        this.reconcile(null, partitionRegions[i]);
      }
    }
  } catch (final BadLocationException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:ReasonReconcilingStrategy.java

示例2: getPartitionsLinesByType

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
public static HashMap<String, Integer> getPartitionsLinesByType(IDocument document,
    String partitionType) {
  HashMap<String, Integer> lines = new HashMap<String, Integer>();
  final Scanner scanner = new Scanner(document.get());
  int lineNumber = 0;
  try {
    while (scanner.hasNextLine()) {
      final String line = scanner.nextLine();
      final int offset = document.getLineOffset(lineNumber);
      if (document.getPartition(offset).getType().equals(partitionType)) {
        lines.put(line, lineNumber);
      }
      lineNumber++;
    }
  } catch (BadLocationException e) {
    e.printStackTrace();
  } finally {
    if (scanner != null)
      scanner.close();
  }

  return lines;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:24,代码来源:EditorUtilities.java

示例3: getPartitionsInfoByType

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
public static HashMap<String, IRegion> getPartitionsInfoByType(IDocument document,
    String partitionType) {
  HashMap<String, IRegion> lines = new HashMap<String, IRegion>();
  final Scanner scanner = new Scanner(document.get());
  int lineNumber = 0;
  try {
    while (scanner.hasNextLine()) {
      final String line = scanner.nextLine();
      final int offset = document.getLineOffset(lineNumber);
      if (document.getPartition(offset).getType().equals(partitionType)) {
        lines.put(line, document.getLineInformation(lineNumber));
      }
      lineNumber++;
    }
  } catch (BadLocationException e) {
    e.printStackTrace();
  } finally {
    if (scanner != null)
      scanner.close();
  }

  return lines;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:24,代码来源:EditorUtilities.java

示例4: getLineByOffset

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
public static String getLineByOffset(IDocument document, int offset) {
  final Scanner scanner = new Scanner(document.get());
  int lineNumber = 0;
  try {
    while (scanner.hasNextLine()) {
      final String line = scanner.nextLine();
      if (lineNumber == document.getLineOfOffset(offset)) {
        return line;
      }
      lineNumber++;
    }
  } catch (BadLocationException e) {
    e.printStackTrace();
  } finally {
    if (scanner != null)
      scanner.close();
  }
  return "";
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:20,代码来源:EditorUtilities.java

示例5: getMethodLineNumbers

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
/**
 * This method returns the line numbers of all the methods passed to it.
 * @param document The document with which the user is interacting.
 * @param vfMethods The list of methods for which the line numbers are required.
 * @return Map containing method names and their starting line numbers.
 */
private Map<String, Integer> getMethodLineNumbers(IDocument document, List<VFMethod> vfMethods) {

	FindReplaceDocumentAdapter findReplaceDocumentAdapter = new FindReplaceDocumentAdapter(document);
	TreeMap<String, Integer> result = new TreeMap<String, Integer>();
	for (VFMethod method : vfMethods) {
		try {
			method.getSootMethod().getBytecodeSignature();

			IRegion region = findReplaceDocumentAdapter.find(0,
					method.getSootMethod().getDeclaration().substring(0, method.getSootMethod().getDeclaration().indexOf('(')), true, true, false, false);
			if (region != null) {
				result.put(method.getSootMethod().getDeclaration(), document.getLineOfOffset(region.getOffset()));
			}

		} catch (BadLocationException e) {
			e.printStackTrace();
		}
	}
	return MapUtil.sortByValue(result);
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:27,代码来源:JavaToCFGHandler.java

示例6: toRange

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
public static Range toRange(IOpenable openable, int offset, int length) throws JavaModelException {
	if (offset > 0 || length > 0) {
		int[] loc = null;
		int[] endLoc = null;
		IBuffer buffer = openable.getBuffer();
		// if (buffer != null) {
		// loc = JsonRpcHelpers.toLine(buffer, offset);
		// endLoc = JsonRpcHelpers.toLine(buffer, offset + length);
		// }
		// if (loc == null) {
		// loc = new int[2];
		// }
		// if (endLoc == null) {
		// endLoc = new int[2];
		// }
		// setPosition(range.getStart(), loc);
		// setPosition(range.getEnd(), endLoc);
		IDocument document = toDocument(buffer);
		try {
			int line = document.getLineOfOffset(offset);
			int column = offset - document.getLineOffset(line);
			return new Range(line + 1, column + 1);
		} catch (BadLocationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:31,代码来源:JDTUtils.java

示例7: lineAppended

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
@Override
public void lineAppended(IRegion region) {
	if (!isStarted()) return;
	try {
		String line = m_console.getDocument().get(region.getOffset(), region.getLength());
		messages.add(line);
	} catch (BadLocationException e) {
		e.printStackTrace();
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:11,代码来源:ConsoleTracker.java

示例8: getPartitionString

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
private String getPartitionString(final ITypedRegion partition) {
  String partitionString = null;
  try {
    partitionString = this.document.get(partition.getOffset(), partition.getLength());
  } catch (final BadLocationException e) {
    e.printStackTrace();
  }
  return partitionString;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:10,代码来源:VisualizationSubscriber.java

示例9: evaluate

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
public void evaluate(final IDocument document, final IRegion dirtyRegion) {
  this.document = document;
  try {
    final ITypedRegion changedPartition =
        dirtyRegion == null ? null : document.getPartition(dirtyRegion.getOffset());
    this.parseRequiredPartitions(changedPartition);
    if (this.kodkodUniverse != null) {
      this.runVisualization(this.visUniverse);
    }
  } catch (final BadLocationException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:14,代码来源:SynchronizationManager.java

示例10: getMethodLineNumber

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
private int getMethodLineNumber(IDocument document, VFMethod method) {
	FindReplaceDocumentAdapter findReplaceDocumentAdapter = new FindReplaceDocumentAdapter(document);
	try {
		method.getSootMethod().getBytecodeSignature();

		IRegion region = findReplaceDocumentAdapter.find(0, method.getSootMethod().getDeclaration(), true, true, false, false);
		return document.getLineOfOffset(region.getOffset());
	} catch (BadLocationException e) {
		e.printStackTrace();
	}
	return -1;

}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:14,代码来源:DataModelImpl.java

示例11: getPartitionsByType

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
public static List<String> getPartitionsByType(IDocument document, String partitionType) {
  List<String> lines = new ArrayList<String>();
  final Scanner scanner = new Scanner(document.get());
  int lineNumber = 0;
  try {
    while (scanner.hasNextLine()) {
      final String line = scanner.nextLine();
      final int offset = document.getLineOffset(lineNumber);
      if (document.getPartition(offset).getType().equals(partitionType)) {
        lines.add(line);
      }
      lineNumber++;
    }
  } catch (BadLocationException e) {
    e.printStackTrace();
  } finally {
    if (scanner != null)
      scanner.close();
  }
  return lines;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:22,代码来源:EditorUtilities.java

示例12: computeCompletionProposals

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
@Override
public ICompletionProposal[] computeCompletionProposals(final ITextViewer viewer,
    final int offset) {
  final List<ICompletionProposal> proposals = new ArrayList<>();
  final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();

  try {
    allFiles.clear();
    allEcoreFiles.clear();
    findAllEMFFiles(root);
    findAllXMIFiles(root);
  } catch (final Exception e) {
    e.printStackTrace();
    return null;
  }

  final IDocument document = viewer.getDocument();
  try {
    IRegion lineInfo = document.getLineInformationOfOffset(offset);
    String line = document.get(lineInfo.getOffset(), lineInfo.getLength());

    int activationIndex = line.indexOf(activationChar);
    if (activationIndex != -1) {
      String prefix = line.substring(line.indexOf("@") + 1);
      String type = document.getPartition(offset - 1).getType();
      int replacementOffset = offset - prefix.length();
      addProposals(proposals, prefix, replacementOffset, type);
    }
  } catch (BadLocationException e1) {
    e1.printStackTrace();
  }

  final ICompletionProposal[] result = new ICompletionProposal[proposals.size()];
  proposals.toArray(result);
  return result;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:37,代码来源:LoadCompletionProcessor.java

示例13: getMethodLineNumbers

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
/**
 * This method returns the line numbers of all the methods passed to it.
 * @param document The document with which the user is interacting.
 * @param vfMethods The list of methods for which the line numbers are required.
 * @return Map containing method names and their starting line numbers.
 */
private Map<String, Integer> getMethodLineNumbers(IDocument document, List<VFMethod> vfMethods) {
	FindReplaceDocumentAdapter findReplaceDocumentAdapter = new FindReplaceDocumentAdapter(document);
	TreeMap<String, Integer> result = new TreeMap<>();
	for (VFMethod method : vfMethods) {
		try {
			method.getSootMethod().getBytecodeSignature();
			IRegion region = findReplaceDocumentAdapter.find(0, method.getSootMethod().getDeclaration(), true, true, false, false);
			result.put(method.getSootMethod().getDeclaration(), document.getLineOfOffset(region.getOffset()));
		} catch (BadLocationException e) {
			e.printStackTrace();
		}
	}
	return MapUtil.sortByValue(result);
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:21,代码来源:NavigationHandler.java

示例14: getMethodOffset

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
/**
 * This method returns the offset of the method passed to it.
 * @param document The document user is interacting with.
 * @param method The method whose offset is required.
 * @return The offset of the method.
 */
private Integer getMethodOffset(IDocument document, VFMethod method) {

	FindReplaceDocumentAdapter findReplaceDocumentAdapter = new FindReplaceDocumentAdapter(document);
	try {
		IRegion region = findReplaceDocumentAdapter.find(0, FindReplaceDocumentAdapter.escapeForRegExPattern(method.getSootMethod().getDeclaration()), true,
				true, false, true);
		return region.getOffset();
	} catch (BadLocationException e) {
		e.printStackTrace();
	}
	return 0;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:19,代码来源:NavigationHandler.java

示例15: computeCompletionProposals

import org.eclipse.jface.text.BadLocationException; //导入方法依赖的package包/类
@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
	final List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
	try {
		final IDocument document = viewer.getDocument();
		Character c = document.getChar(offset - 1);
		int temp = offset - 1;
		String s = "";

		if (Character.isAlphabetic(c)) {
			while (Character.isAlphabetic(c)) {
				s += c;
				temp--;
				c = document.getChar(temp);
			}
			s = new StringBuilder(s).reverse().toString();

			for (int i = 0; i < FormulasScanner.formulasKeywords.length; i++) {
				if (FormulasScanner.formulasKeywords[i].startsWith(s)) {
					proposals.add(new CompletionProposal(FormulasScanner.formulasKeywords[i], temp + 1, s.length(),
							FormulasScanner.formulasKeywords[i].length()));
				}
			}
		} else if (c == '(') {
			document.replace(temp, 1, "()");
		} else if (c == '[') {
			document.replace(temp, 1, "[]");
		}

		if (proposals.isEmpty() && s == "") {
			for (int i = 0; i < FormulasScanner.formulasKeywords.length; i++) {
				proposals.add(new CompletionProposal(FormulasScanner.formulasKeywords[i], temp + 1, s.length(),
						FormulasScanner.formulasKeywords[i].length()));
			}
		}

	} catch (final BadLocationException e) {
		e.printStackTrace();
	}
	final ICompletionProposal[] result = new ICompletionProposal[proposals.size()];
	proposals.toArray(result);
	return result;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:44,代码来源:CodeCompletionProcessor.java


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