Exemplo n.º 1
0
 private String makeMD5(String text) {
   java.security.MessageDigest md = null;
   byte[] encryptMsg = null;
   try {
     md = java.security.MessageDigest.getInstance("MD5");
     encryptMsg = md.digest(text.getBytes());
   } catch (java.security.NoSuchAlgorithmException e) {
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelUIPlugin.logError(
         "NoSuchAlgorithmException while creating MD5 checksum.", e);
     return "";
   }
   String swap = "";
   String byteStr = "";
   StringBuffer strBuf = new StringBuffer();
   for (int i = 0; i <= encryptMsg.length - 1; i++) {
     byteStr = Integer.toHexString(encryptMsg[i]);
     switch (byteStr.length()) {
       case 1: // if hex-number length is 1, add a '0' before
         swap = "0" + Integer.toHexString(encryptMsg[i]);
         break;
       case 2: // correct hex-letter
         swap = Integer.toHexString(encryptMsg[i]);
         break;
       case 8: // get the correct substring
         swap = (Integer.toHexString(encryptMsg[i])).substring(6, 8);
         break;
     }
     strBuf.append(swap);
     // appending swap to get complete hash-key
   }
   return strBuf.toString();
 }
Exemplo n.º 2
0
 /**
  * Creates a new editor configuration.
  *
  * @param resourceProvider the provider for the resource (usually this is the editor)
  * @param colorManager the color manager to use
  */
 public TestmodelSourceViewerConfiguration(
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ITestmodelResourceProvider
         resourceProvider,
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui
             .ITestmodelAnnotationModelProvider
         annotationModelProvider,
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.ITestmodelBracketHandlerProvider
         bracketHandlerProvider,
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelColorManager
         colorManager) {
   super(
       edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelUIPlugin.getDefault()
           .getPreferenceStore());
   this.fPreferenceStore.setDefault(
       org.eclipse.ui.texteditor.spelling.SpellingService.PREFERENCE_SPELLING_ENABLED, true);
   this.fPreferenceStore.setDefault(
       org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH,
       4);
   this.fPreferenceStore.setDefault(
       org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants
           .EDITOR_HYPERLINK_KEY_MODIFIER,
       org.eclipse.jface.action.Action.findModifierString(org.eclipse.swt.SWT.MOD1));
   this.resourceProvider = resourceProvider;
   this.annotationModelProvider = annotationModelProvider;
   this.bracketHandlerProvider = bracketHandlerProvider;
   this.colorManager = colorManager;
 }