Search in sources :

Example 1 with SwingInvoker

use of com.google.security.zynamics.zylib.gui.SwingInvoker in project binnavi by google.

the class CMemorySectionPanelSynchronizer method updateGui.

/**
 * Updates the GUI of the synchronized memory section box depending on the current state of the
 * debug GUI perspective and the active debugger.
 */
private void updateGui() {
    final IDebugger activeDebugger = debugPerspectiveModel.getCurrentSelectedDebugger();
    final TargetProcessThread activeThread = activeDebugger == null ? null : activeDebugger.getProcessManager().getActiveThread();
    final boolean enable = (activeThread != null) && (activeDebugger != null) && activeDebugger.isConnected() && (activeDebugger.getProcessManager().getTargetInformation() != null) && activeDebugger.getProcessManager().getTargetInformation().getDebuggerOptions().canMemmap() && (memorySectionBox.getItemCount() != 0);
    new SwingInvoker() {

        @Override
        protected void operation() {
            memorySectionBox.setEnabled(enable);
        }
    }.invokeAndWait();
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) SwingInvoker(com.google.security.zynamics.zylib.gui.SwingInvoker) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 2 with SwingInvoker

use of com.google.security.zynamics.zylib.gui.SwingInvoker in project binnavi by google.

the class CMemorySectionPanelSynchronizer method updateMemoryBox.

/**
 * Updates the memory selection box.
 */
private void updateMemoryBox() {
    final IDebugger activeDebugger = debugPerspectiveModel.getCurrentSelectedDebugger();
    final ArrayList<CMemorySectionWrapper> sections = new ArrayList<>();
    if ((activeDebugger != null) && activeDebugger.isConnected()) {
        for (final MemorySection section : activeDebugger.getProcessManager().getMemoryMap()) {
            sections.add(new CMemorySectionWrapper(section));
        }
    }
    new SwingInvoker() {

        @Override
        protected void operation() {
            memorySectionBox.removeAllItems();
            if ((activeDebugger != null) && activeDebugger.isConnected()) {
                for (final CMemorySectionWrapper sectionWrapper : sections) {
                    memorySectionBox.addItem(sectionWrapper);
                }
            }
        }
    }.invokeAndWait();
}
Also used : MemorySection(com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection) ArrayList(java.util.ArrayList) SwingInvoker(com.google.security.zynamics.zylib.gui.SwingInvoker) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 3 with SwingInvoker

use of com.google.security.zynamics.zylib.gui.SwingInvoker in project binnavi by google.

the class CAddressSpaceFunctions method loadAddressSpaces.

/**
 * Loads one or more address spaces.
 *
 * @param projectTree Project tree of the main window.
 * @param addressSpaces The address spaces to load.
 */
public static void loadAddressSpaces(final JTree projectTree, final INaviAddressSpace[] addressSpaces) {
    new Thread() {

        @Override
        public void run() {
            final CDefaultProgressOperation operation = new CDefaultProgressOperation("Loading address spaces", false, true);
            operation.getProgressPanel().setMaximum(addressSpaces.length);
            for (final INaviAddressSpace addressSpace : addressSpaces) {
                operation.getProgressPanel().setText("Loading address spaces" + ": '" + addressSpace.getConfiguration().getName() + "'");
                try {
                    addressSpace.load();
                    new SwingInvoker() {

                        @Override
                        protected void operation() {
                            CNodeExpander.expandNode(projectTree, addressSpace);
                        }
                    }.invokeLater();
                } catch (final CouldntLoadDataException exception) {
                    CUtilityFunctions.logException(exception);
                    final String message = "E00109: " + "Address space could not be loaded";
                    final String description = CUtilityFunctions.createDescription(String.format("The address space '%s' could not be loaded. Try loading the address space again. If the problem persists, disconnect from and reconnect to the database, restart com.google.security.zynamics.binnavi, or contact the BinNavi support.", addressSpace.getConfiguration().getName()), new String[] { "Database connection problems." }, new String[] { "The address space was not loaded." });
                    NaviErrorDialog.show(SwingUtilities.getWindowAncestor(projectTree), message, description, exception);
                } catch (final LoadCancelledException e) {
                // Do nothing
                } finally {
                    operation.getProgressPanel().next();
                }
            }
            operation.stop();
        }
    }.start();
}
Also used : CDefaultProgressOperation(com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) SwingInvoker(com.google.security.zynamics.zylib.gui.SwingInvoker) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Example 4 with SwingInvoker

use of com.google.security.zynamics.zylib.gui.SwingInvoker in project binnavi by google.

the class CProgressPanel method setText.

public void setText(final String description) {
    m_description = description;
    String text = convertTextToHtml(description);
    text = fitTextToLabel(text);
    m_label.setText(text);
    new SwingInvoker() {

        @Override
        public void operation() {
            m_label.updateUI();
        }
    }.invokeLater();
}
Also used : SwingInvoker(com.google.security.zynamics.zylib.gui.SwingInvoker)

Example 5 with SwingInvoker

use of com.google.security.zynamics.zylib.gui.SwingInvoker in project binnavi by google.

the class CProgressPanel method setSubText.

public void setSubText(final String subDescription) {
    String text = fitTextToLabel(m_description) + "\n";
    text += fitTextToLabel(subDescription);
    m_label.setText(convertTextToHtml(text));
    new SwingInvoker() {

        @Override
        public void operation() {
            m_label.updateUI();
        }
    }.invokeLater();
}
Also used : SwingInvoker(com.google.security.zynamics.zylib.gui.SwingInvoker)

Aggregations

SwingInvoker (com.google.security.zynamics.zylib.gui.SwingInvoker)8 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)2 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)2 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)2 CDefaultProgressOperation (com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation)1 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)1 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)1 INaviAddressSpace (com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)1 ILayoutSettings (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.settings.ILayoutSettings)1 ArrayList (java.util.ArrayList)1 BufferedLayouter (y.layout.BufferedLayouter)1 GraphLayout (y.layout.GraphLayout)1 LabelLayoutTranslator (y.layout.LabelLayoutTranslator)1 DefaultGraph2DRenderer (y.view.DefaultGraph2DRenderer)1 LayoutMorpher (y.view.LayoutMorpher)1