Skip to content

Commit

Permalink
Merge pull request #62 from scriptjunkie/master
Browse files Browse the repository at this point in the history
GUI bugfixes
  • Loading branch information
Tod Beardsley committed Dec 16, 2011
2 parents c0abbe2 + 5bad92e commit 6fc20d6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 21 deletions.
Binary file modified data/gui/msfgui.jar
Binary file not shown.
Expand Up @@ -265,6 +265,7 @@ else if(token.equals("port:"))
token = s.next();
}
} catch (FileNotFoundException fnfox){
fnfox.printStackTrace();
}
showDefaults();
}
Expand Down
4 changes: 3 additions & 1 deletion external/source/gui/msfguijava/src/msfgui/MainFrame.java 100644 → 100755
Expand Up @@ -265,7 +265,8 @@ protected List doInBackground() throws Exception {
}
publish((Object)jobStrings);
} catch (MsfException msfEx) {
msfEx.printStackTrace();
if(!MsfguiApp.shuttingDown || !msfEx.getMessage().contains("Connection refused"))
msfEx.printStackTrace();
publish("Error getting session list "+msfEx);
if(!msfEx.getMessage().contains("timed out")) // on timeout, just retry
return new ArrayList();
Expand Down Expand Up @@ -1655,6 +1656,7 @@ public void action() throws Exception {
});
jobsList.addMouseListener( new PopupMouseListener() {
public void mouseReleased(MouseEvent e){
super.mouseReleased(e);
int indx = jobsList.locationToIndex(e.getPoint());
if (indx == -1)
return;
Expand Down
Expand Up @@ -3,8 +3,6 @@
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -199,8 +197,7 @@ protected void delete() {
/** Retrieves list of files. */
private void getFiles() {
//Set up locking so the console doesn't eat our output
if(!lock.tryLock())
lock.lock();
lock.lock();

while(model.getRowCount() > 0)
model.removeRow(0);
Expand Down Expand Up @@ -243,10 +240,8 @@ public void actionPerformed(ActionEvent e) {
for(int i = 0; i < mainTable.getColumnCount(); i++)
if(mainTable.getColumnName(i).equals("Name"))
nameColumn = i;
if(nameColumn != -1){
if(nameColumn != -1)
mainTable.moveColumn(nameColumn, 0);
stop();
}
} catch (Exception ex) {
ex.printStackTrace();
if(ex.getMessage().toLowerCase().contains("unknown session"))
Expand Down
Expand Up @@ -103,7 +103,6 @@ public static RpcConnection getConnection(MainFrame mainframe) {
String host = info.get("host").toString();
int port = Integer.parseInt(info.get("port").toString());
boolean ssl = Boolean.parseBoolean(info.get("ssl").toString());
String type = info.get("type").toString();
RpcConnection rpc = RpcConnection.getConn(username, password.toCharArray(), host, port, ssl);
if(javax.swing.JOptionPane.showConfirmDialog(null, "Connect to last remembered rpcd?") == javax.swing.JOptionPane.YES_OPTION)
return rpc;
Expand Down
14 changes: 2 additions & 12 deletions external/source/gui/msfguijava/src/msfgui/ProcessList.java
Expand Up @@ -57,30 +57,19 @@ public Class getColumnClass(int columnIndex) {
this.rpcConn = rpcConn;
this.session = session;
this.lock = (ReentrantLock)sessionPopupMap.get(session.get("id")+"lock");
((DraggableTabbedPane)tabbedPane).setTabFocusListener(0, new FocusListener() {
public void focusGained(FocusEvent e) {
if(!lock.tryLock())
lock.lock();
}
public void focusLost(FocusEvent e) {
while(lock.getHoldCount() > 0)
lock.unlock();
}
});
//See if we need to move our tab
Map props = MsfguiApp.getPropertiesNode();
if(!props.get("tabWindowPreference").equals("window")){
((DraggableTabbedPane)tabbedPane).moveTabTo(0, DraggableTabbedPane.getTabPane(
(Component)sessionPopupMap.get(session.get("id")+"console")));
DraggableTabbedPane.show(mainPanel);
}
if(!lock.tryLock())
lock.lock();
listProcs();
}

/** Lists the processes that are running */
protected void listProcs() throws HeadlessException {
lock.lock();
if (runCommand("ps"))
return;
readTimer = new Timer(300, new ActionListener() {
Expand Down Expand Up @@ -113,6 +102,7 @@ public void actionPerformed(ActionEvent e) {
readTimer.stop();
MsfguiApp.showMessage(null, ex.getMessage());
}
lock.unlock();
}
});
readTimer.start();
Expand Down

0 comments on commit 6fc20d6

Please sign in to comment.