Code formatting

This commit is contained in:
Jindra Pet��k
2012-12-25 11:33:41 +01:00
parent 24a6b82a94
commit 14ae8e435c
643 changed files with 26017 additions and 27040 deletions
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.asdec.abc.gui;
import com.jpexs.asdec.Main;
@@ -31,7 +30,7 @@ import java.util.List;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseListener,CaretListener {
public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseListener, CaretListener {
private List<Highlighting> highlights = new ArrayList<Highlighting>();
private List<Highlighting> traitHighlights = new ArrayList<Highlighting>();
@@ -40,24 +39,22 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
private int classIndex;
public int lastTraitIndex = 0;
public void setNoTrait()
{
public void setNoTrait() {
Main.abcMainFrame.detailPanel.showCard(DetailPanel.UNSUPPORTED_TRAIT_CARD);
}
private boolean displayMethod(int pos,int methodIndex)
{
private boolean displayMethod(int pos, int methodIndex) {
int bi = abc.findBodyIndex(methodIndex);
if (bi == -1) {
return false;
}
Main.abcMainFrame.detailPanel.showCard(DetailPanel.METHOD_TRAIT_CARD);
Main.abcMainFrame.detailPanel.showCard(DetailPanel.METHOD_TRAIT_CARD);
if (Main.abcMainFrame.detailPanel.methodTraitPanel.methodCodePanel.sourceTextArea.bodyIndex != bi) {
Main.abcMainFrame.detailPanel.methodTraitPanel.methodCodePanel.sourceTextArea.setBodyIndex(bi, abc);
Main.abcMainFrame.detailPanel.methodTraitPanel.methodBodyParamsPanel.loadFromBody(abc.bodies[bi]);
Main.abcMainFrame.detailPanel.methodTraitPanel.methodInfoPanel.load(abc.bodies[bi].method_info, abc);
}
boolean success=false;
boolean success = false;
for (Highlighting h : highlights) {
if ((pos >= h.startPos) && (pos < h.startPos + h.len)) {
try {
@@ -65,36 +62,36 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
} catch (ConvertException ex) {
}
success=true;
success = true;
//return true;
}
}
return success;
}
public void caretUpdate(CaretEvent e) {
getCaret().setVisible(true);
int pos = getCaretPosition();
for (Highlighting tm : methodHighlights) {
if ((pos >= tm.startPos) && (pos < tm.startPos + tm.len)) {
displayMethod(pos,(int)tm.offset);
displayMethod(pos, (int) tm.offset);
return;
}
}
for (Highlighting th : traitHighlights) {
if ((pos >= th.startPos) && (pos < th.startPos + th.len)) {
lastTraitIndex = (int) th.offset;
Trait tr=abc.findTraitByTraitId(classIndex, (int) th.offset);
if(tr!=null){
if(tr instanceof TraitSlotConst){
Main.abcMainFrame.detailPanel.slotConstTraitPanel.load((TraitSlotConst)tr, abc);
Trait tr = abc.findTraitByTraitId(classIndex, (int) th.offset);
if (tr != null) {
if (tr instanceof TraitSlotConst) {
Main.abcMainFrame.detailPanel.slotConstTraitPanel.load((TraitSlotConst) tr, abc);
Main.abcMainFrame.detailPanel.showCard(DetailPanel.SLOT_CONST_TRAIT_CARD);
return;
}
}
displayMethod(pos,abc.findMethodIdByTraitId(classIndex, (int) th.offset));
displayMethod(pos, abc.findMethodIdByTraitId(classIndex, (int) th.offset));
return;
}
}
}
setNoTrait();
}
@@ -106,7 +103,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
public List<Highlighting> traitHighlights;
public List<Highlighting> methodHighlights;
public BufferedClass(String text, List<Highlighting> highlights, List<Highlighting> traitHighlights,List<Highlighting> methodHighlights) {
public BufferedClass(String text, List<Highlighting> highlights, List<Highlighting> traitHighlights, List<Highlighting> methodHighlights) {
this.text = text;
this.highlights = highlights;
this.traitHighlights = traitHighlights;
@@ -120,18 +117,16 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
}
public void gotoTrait(int traitId) {
if(traitId==-1)
{
if (traitId == -1) {
setCaretPosition(0);
return;
}
for (Highlighting th : traitHighlights) {
if (th.offset == traitId) {
try{
try {
setCaretPosition(th.startPos + th.len - 1);
setCaretPosition(th.startPos);
}catch(IllegalArgumentException iae){
} catch (IllegalArgumentException iae) {
}
return;
}
@@ -156,13 +151,13 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
traitHighlights = Highlighting.getTraitHighlights(hilightedCode);
methodHighlights = Highlighting.getMethodHighlights(hilightedCode);
hilightedCode = Highlighting.stripHilights(hilightedCode);
bufferedClasses.put(index, new BufferedClass(hilightedCode, highlights, traitHighlights,methodHighlights));
bufferedClasses.put(index, new BufferedClass(hilightedCode, highlights, traitHighlights, methodHighlights));
} else {
BufferedClass bc = bufferedClasses.get(index);
hilightedCode = bc.text;
highlights = bc.highlights;
traitHighlights = bc.traitHighlights;
methodHighlights=bc.methodHighlights;
methodHighlights = bc.methodHighlights;
}
setText(hilightedCode);
this.abc = abc;
@@ -187,8 +182,6 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {