forked from NearInfinityBrowser/NearInfinity
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to edit numeric data as unsigned number in structured reso…
…urces - Existing context menu entry "Edit as number" renamed to "Edit as signed number" - Added new context menu entry "Edit as unsigned number" - Values in "Edit as hexadecimal number" mode are treated as unsigned numbers
- Loading branch information
Showing
2 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Near Infinity - An Infinity Engine Browser and Editor | ||
// Copyright (C) 2001 Jon Olav Hauglid | ||
// See LICENSE.txt for license information | ||
|
||
package org.infinity.datatype; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class UnsignHexNumber extends UnsignDecNumber { | ||
public UnsignHexNumber(ByteBuffer buffer, int offset, int length, String desc) { | ||
super(buffer, offset, length, desc); | ||
} | ||
|
||
// --------------------- Begin Interface InlineEditable --------------------- | ||
|
||
@Override | ||
public boolean update(Object value) { | ||
try { | ||
setValue(UnsignDecNumber.parseNumber(value, getSize(), false, true)); | ||
return true; | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
return false; | ||
} | ||
|
||
// --------------------- End Interface InlineEditable --------------------- | ||
|
||
@Override | ||
public String toString() { | ||
return Long.toHexString(getLongValue() & 0xffffffffL) + " h"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters