public void setViewerSpecificContributionsEnabled(boolean enabled) { super.setViewerSpecificContributionsEnabled(enabled); fShowTooltipAction.setEnabled(enabled); fContentAssist.setEnabled(enabled); // cleanup and format document actions do not rely on source viewer // being enabled // fCleanupDocument.setEnabled(enabled); // fFormatDocument.setEnabled(enabled); fFormatActiveElements.setEnabled(enabled); fOpenFileAction.setEnabled(enabled); fFindOccurrences.setEnabled(enabled); } }
/** * Updates to the changes of the underlying action. * * @param event the change event describing the state change */ private void update(PropertyChangeEvent event) { if (ENABLED.equals(event.getProperty())) { Boolean bool= (Boolean) event.getNewValue(); setEnabled(bool.booleanValue()); } else if (TEXT.equals(event.getProperty())) setText((String) event.getNewValue()); else if (TOOL_TIP_TEXT.equals(event.getProperty())) setToolTipText((String) event.getNewValue()); else if (CHECKED.equals(event.getProperty())) { Boolean bool= (Boolean) event.getNewValue(); setChecked(bool.booleanValue()); } }
/** * Updates to the changes of the underlying action. * * @param event the change event describing the state change */ private void update(PropertyChangeEvent event) { if (ENABLED.equals(event.getProperty())) { Boolean bool= (Boolean) event.getNewValue(); setEnabled(bool.booleanValue()); } else if (TEXT.equals(event.getProperty())) setText((String) event.getNewValue()); else if (TOOL_TIP_TEXT.equals(event.getProperty())) setToolTipText((String) event.getNewValue()); else if (CHECKED.equals(event.getProperty())) { Boolean bool= (Boolean) event.getNewValue(); setChecked(bool.booleanValue()); } }
/** * Updates to the changes of the underlying action. * * @param event the change event describing the state change */ private void update(PropertyChangeEvent event) { if (ENABLED.equals(event.getProperty())) { Boolean bool= (Boolean) event.getNewValue(); setEnabled(bool.booleanValue()); } else if (TEXT.equals(event.getProperty())) setText((String) event.getNewValue()); else if (TOOL_TIP_TEXT.equals(event.getProperty())) setToolTipText((String) event.getNewValue()); else if (CHECKED.equals(event.getProperty())) { Boolean bool= (Boolean) event.getNewValue(); setChecked(bool.booleanValue()); } }
/** * Sets the underlying action. * * @param action the underlying action */ public void setAction(IAction action) { if (fAction != null) { fAction.removePropertyChangeListener(fListener); fAction= null; } fAction= action; if (fAction == null) { setEnabled(false); if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) setChecked(false); setText(fDefaultText); setToolTipText(""); //$NON-NLS-1$ } else { setEnabled(fAction.isEnabled()); if (fAction.getStyle() == AS_CHECK_BOX || fAction.getStyle() == AS_RADIO_BUTTON) super.setChecked(fAction.isChecked()); setText(fAction.getText()); setToolTipText(fAction.getToolTipText()); fAction.addPropertyChangeListener(fListener); } }
/** * Sets the underlying action. * * @param action the underlying action */ public void setAction(IAction action) { if (fAction != null) { fAction.removePropertyChangeListener(fListener); fAction= null; } fAction= action; if (fAction == null) { setEnabled(false); if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) setChecked(false); setText(fDefaultText); setToolTipText(""); //$NON-NLS-1$ } else { setEnabled(fAction.isEnabled()); if (fAction.getStyle() == AS_CHECK_BOX || fAction.getStyle() == AS_RADIO_BUTTON) super.setChecked(fAction.isChecked()); setText(fAction.getText()); setToolTipText(fAction.getToolTipText()); fAction.addPropertyChangeListener(fListener); } }
/** * Sets the underlying action. * * @param action the underlying action */ public void setAction(IAction action) { if (fAction != null) { fAction.removePropertyChangeListener(fListener); fAction= null; } fAction= action; if (fAction == null) { setEnabled(false); if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) setChecked(false); setText(fDefaultText); setToolTipText(""); //$NON-NLS-1$ } else { setEnabled(fAction.isEnabled()); if (fAction.getStyle() == AS_CHECK_BOX || fAction.getStyle() == AS_RADIO_BUTTON) super.setChecked(fAction.isChecked()); setText(fAction.getText()); setToolTipText(fAction.getToolTipText()); fAction.addPropertyChangeListener(fListener); } }
/** * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart) */ public void setActiveEditor(IEditorPart activeEditor) { if (getActiveEditorPart() == activeEditor) { return; } super.setActiveEditor(activeEditor); IActionBars actionBars = getActionBars(); if (actionBars != null) { IStatusLineManager statusLineManager = actionBars.getStatusLineManager(); if (statusLineManager != null) { statusLineManager.setMessage(null); statusLineManager.setErrorMessage(null); } } ITextEditor textEditor = getTextEditor(activeEditor); fShowTooltipAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_INFORMATION)); fContentAssist.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS)); fCleanupDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT)); fFormatDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT)); fFormatActiveElements.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS)); fCleanupDocument.setEnabled((textEditor != null) && textEditor.isEditable()); fFormatDocument.setEnabled((textEditor != null) && textEditor.isEditable()); fFormatActiveElements.setEnabled((textEditor != null) && textEditor.isEditable()); fOpenFileAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE)); fFindOccurrences.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES)); }