object Query_Dockable { privateabstractclass Operation(view: View) { val pretty_text_area = new Pretty_Text_Area(view) def query_operation: Query_Operation def query: JComponent def select(): Unit def page: TabbedPane.Page
}
}
class Query_Dockable(view: View, position: String) extends Dockable(view, position) { /* common GUI components */
privateval zoom = new Font_Info.Zoom { overridedef changed(): Unit = handle_resize() }
privatedef make_query(
property: String,
tooltip: String,
apply_query: () => Unit
): Completion_Popup.History_Text_Field = { new Completion_Popup.History_Text_Field(property) { overridedef processKeyEvent(evt: KeyEvent): Unit = { if (evt.getID == KeyEvent.KEY_PRESSED && evt.getKeyCode == KeyEvent.VK_ENTER) apply_query() super.processKeyEvent(evt)
}
{ val max = getPreferredSize; max.width = Int.MaxValue; setMaximumSize(max) }
setColumns(40)
setToolTipText(tooltip)
setFont(GUI.imitate_font(getFont, scale = 1.2))
}
}
/* consume status */
def consume_status(
process_indicator: Process_Indicator,
status: Query_Operation.Status
): Unit = {
status match { case Query_Operation.Status.waiting =>
process_indicator.update("Waiting for evaluation of context ...", 5) case Query_Operation.Status.running =>
process_indicator.update("Running find operation ...", 15) case Query_Operation.Status.finished =>
process_indicator.update(null, 0)
}
}
/* find theorems */
privateval find_theorems: Query_Dockable.Operation = new Query_Dockable.Operation(view) { /* query */
privateval process_indicator = new Process_Indicator
val query_operation = new Query_Operation(PIDE.editor, view, "find_theorems",
consume_status(process_indicator, _), pretty_text_area.update_output)
privatedef apply_query(): Unit = {
query.addCurrentToHistory()
query_operation.apply_query(List(limit.text, allow_dups.selected.toString, query.getText))
}
privateval query_tooltip =
GUI.tooltip_lines( "Search criteria for find operation, e.g.\n\"_ = _\" \"(+)\" name: Group -name: monoid")
val query: Completion_Popup.History_Text_Field =
make_query("isabelle-find-theorems", query_tooltip, apply_query _)
def select(): Unit = { control_panel.contents += zoom }
val page = new TabbedPane.Page("Find Theorems", new BorderPanel {
layout(control_panel) = BorderPanel.Position.North
layout(Component.wrap(pretty_text_area)) = BorderPanel.Position.Center
}, apply_button.tooltip)
}
/* find consts */
privateval find_consts: Query_Dockable.Operation = new Query_Dockable.Operation(view) { /* query */
privateval process_indicator = new Process_Indicator
val query_operation = new Query_Operation(PIDE.editor, view, "find_consts",
consume_status(process_indicator, _), pretty_text_area.update_output)
privateval query_label = new Label("Find:") {
tooltip = GUI.tooltip_lines("Name / type patterns for constants")
}
val query: Completion_Popup.History_Text_Field =
make_query("isabelle-find-consts", query_label.tooltip, apply_query _)
privatedef apply_query(): Unit = {
query.addCurrentToHistory()
query_operation.apply_query(List(query.getText))
}
/* GUI page */
privateval apply_button = new GUI.Button(GUI.Style_HTML.enclose_bold("Apply")) {
tooltip = "Find constants by name / type patterns" overridedef clicked(): Unit = apply_query()
}
privateval process_indicator = new Process_Indicator
val query_operation = new Query_Operation(PIDE.editor, view, "print_operation",
consume_status(process_indicator, _), pretty_text_area.update_output)
privatedef apply_query(): Unit =
query_operation.apply_query(selected_items())
privateval query_label = new Label("Print:") def query: JComponent = apply_button.peer
update_items()
/* GUI page */
privateval apply_button = new GUI.Button(GUI.Style_HTML.enclose_bold("Apply")) {
tooltip = "Apply to current context" overridedef clicked(): Unit = apply_query()
val page = new TabbedPane.Page("Print Context", new BorderPanel {
layout(control_panel) = BorderPanel.Position.North
layout(Component.wrap(pretty_text_area)) = BorderPanel.Position.Center
}, "Print information from context")
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.