org.eclipse.ui.menus.UIElement Java Examples

The following examples show how to use org.eclipse.ui.menus.UIElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChangeEditorLayoutHandler.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void updateElement(UIElement element, Map parameters) {
	String layout = (String) parameters.get("xliffEditor.layout");
	if (XLIFFEditorImplWithNatTable.getCurrent().isHorizontalLayout()) {
		ImageDescriptor horizontalImageDescriptor = Activator
				.getImageDescriptor(layout == null ? ImageConstant.TOOL_LAYOUT_HORIZONTAL
						: "images/view/horizontal.png");
		element.setIcon(horizontalImageDescriptor);
		element.setTooltip(Messages.getString("handler.ChangeEditorLayoutHandler.horizontalTooltip"));
	} else {
		ImageDescriptor verticalImageDescriptor = Activator
				.getImageDescriptor(layout == null ? ImageConstant.TOOL_LAYOUT_VERTICAL
						: "images/view/vertical.png");
		element.setIcon(verticalImageDescriptor);
		element.setTooltip(Messages.getString("handler.ChangeEditorLayoutHandler.verticalTooltip"));
	}
}
 
Example #2
Source File: AbstractToggleCurrentLockHandler.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void updateElement(UIElement element, Map parameters){
	IPersistentObject po = ElexisEventDispatcher.getSelected(getTemplateClass());
	if (po == null) {
		element.setIcon(Images.IMG_LOCK_CLOSED.getImageDescriptor());
		element.setChecked(false);
		return;
	}
	
	if (LocalLockServiceHolder.get().isLockedLocal(po)) {
		element.setIcon(Images.IMG_LOCK_OPEN.getImageDescriptor());
		element.setChecked(true);
	} else {
		element.setIcon(Images.IMG_LOCK_CLOSED.getImageDescriptor());
		element.setChecked(false);
	}
}
 
Example #3
Source File: ChangeEditorLayoutHandler.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
public void updateElement(UIElement element, Map parameters) {
	String layout = (String) parameters.get("xliffEditor.layout");
	if (XLIFFEditorImplWithNatTable.getCurrent().isHorizontalLayout()) {
		ImageDescriptor horizontalImageDescriptor = Activator
				.getImageDescriptor(layout == null ? ImageConstant.TOOL_LAYOUT_HORIZONTAL
						: "images/view/horizontal.png");
		element.setIcon(horizontalImageDescriptor);
		element.setTooltip(Messages.getString("handler.ChangeEditorLayoutHandler.horizontalTooltip"));
	} else {
		ImageDescriptor verticalImageDescriptor = Activator
				.getImageDescriptor(layout == null ? ImageConstant.TOOL_LAYOUT_VERTICAL
						: "images/view/vertical.png");
		element.setIcon(verticalImageDescriptor);
		element.setTooltip(Messages.getString("handler.ChangeEditorLayoutHandler.verticalTooltip"));
	}
}
 
Example #4
Source File: OpenViewHandler.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public void updateElement(final UIElement element, Map parameters) {
	if (parameters.get("ViewId") == null) {
		return;
	}
	
	final String viewId = (String) parameters.get("ViewId");
	Display.getDefault().asyncExec(new Runnable() {
		public void run() {
			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (window == null) {
				return;
			}
			IWorkbenchPage workbenchPage = window.getActivePage();
			
			if (workbenchPage == null) {
				return;
			}
			IViewPart view = workbenchPage.findView(viewId);
			
			if (view == null) {
				element.setIcon(Activator.getImageDescriptor("icons/disabled_co.png"));
			} else {
				element.setIcon(Activator.getImageDescriptor("icons/enabled_co.png"));
			}
		}
	});
}
 
Example #5
Source File: OpenViewHandler.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public void updateElement(final UIElement element, Map parameters) {
	if (parameters.get("ViewId") == null) {
		return;
	}
	
	final String viewId = (String) parameters.get("ViewId");
	Display.getDefault().asyncExec(new Runnable() {
		public void run() {
			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (window == null) {
				return;
			}
			IWorkbenchPage workbenchPage = window.getActivePage();
			
			if (workbenchPage == null) {
				return;
			}
			IViewPart view = workbenchPage.findView(viewId);
			
			if (view == null) {
				element.setIcon(Activator.getImageDescriptor("icons/disabled_co.png"));
			} else {
				element.setIcon(Activator.getImageDescriptor("icons/enabled_co.png"));
			}
		}
	});
}
 
Example #6
Source File: OpenToolBarHandler.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public void updateElement(final UIElement element, Map parameters) {
	Display.getDefault().asyncExec(new Runnable() {
		public void run() {
			final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (activeWorkbenchWindow instanceof WorkbenchWindow) {
				WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
				boolean coolbarVisible = window.getCoolBarVisible();
				element.setIcon(coolbarVisible ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator
						.getImageDescriptor("icons/disabled_co.png"));
			}
		}
	});
	
}
 
Example #7
Source File: OpenStatusBarHandler.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public void updateElement(UIElement element, Map parameters) {
	IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
	boolean oldValue = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status);
	element.setIcon(oldValue ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator
			.getImageDescriptor("icons/disabled_co.png"));
}
 
Example #8
Source File: OpenStatusBarHandler.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public void updateElement(UIElement element, Map parameters) {
	IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
	boolean oldValue = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status);
	element.setIcon(oldValue ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator
			.getImageDescriptor("icons/disabled_co.png"));
}
 
Example #9
Source File: OpenToolBarHandler.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public void updateElement(final UIElement element, Map parameters) {
	Display.getDefault().asyncExec(new Runnable() {
		public void run() {
			final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (activeWorkbenchWindow instanceof WorkbenchWindow) {
				WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
				boolean coolbarVisible = window.getCoolBarVisible();
				element.setIcon(coolbarVisible ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator
						.getImageDescriptor("icons/disabled_co.png"));
			}
		}
	});
	
}
 
Example #10
Source File: LockStatusDialogHandler.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void updateElement(UIElement element, Map parameters){
	if (localIcon == null || remoteIcon == null || standaloneIcon == null) {
		prepareIcons();
	}
	ILocalLockService.Status status = LocalLockServiceHolder.get().getStatus();
	
	if (status == Status.STANDALONE) {
		element.setIcon(standaloneIcon);
	} else if (status == Status.LOCAL) {
		element.setIcon(localIcon);
	} else if (status == Status.REMOTE) {
		element.setIcon(remoteIcon);
	}
}
 
Example #11
Source File: PlayPauseSimulationHandler.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setTooltip("Runs or pauses the current experiment (" + GamaKeyBindings.PLAY_STRING + ")");
	if (GAMA.isPaused())
		element.setText("Run Experiment (" + GamaKeyBindings.PLAY_STRING + ")");
	else
		element.setText("Pause Experiment (" + GamaKeyBindings.PLAY_STRING + ")");

}
 
Example #12
Source File: SwitchPerspectiveHandler.java    From tlaplus with MIT License 5 votes vote down vote up
public void updateElement(UIElement element, Map parameters)
{
    String parameter = (String) parameters.get(PARAM_PERSPECTIVE_ID);
    if (parameter != null)
    {
        if (UIHelper.getActivePerspectiveId().equals(parameter))
        {
            element.setChecked(true);
        } else
        {
            element.setChecked(false);
        }
    }
}
 
Example #13
Source File: StockSCSToggleArticleOutlay.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters){
	boolean isSuspended =
		ConfigServiceHolder.get().getLocal(Preferences.INVENTORY_MACHINE_SUSPEND_OUTLAY,
			Preferences.INVENTORY_MACHINE_SUSPEND_OUTLAY_DEFAULT);
	if (isSuspended) {
		element.setChecked(false);
		element.setIcon(Images.IMG_DRAWER.getImageDescriptor());
	} else {
		element.setChecked(true);
		element.setIcon(Images.IMG_DRAWER_ARROW.getImageDescriptor());
	}
}
 
Example #14
Source File: ShowGcpStatusHandler.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void updateElement(
    UIElement element,
    @SuppressWarnings("rawtypes") Map parameters,
    GcpStatusMonitoringService service) {
  GcpStatus status = service.getCurrentStatus();
  element.setText("Status: " + status.summary);
  switch (status.severity) {
    case OK:
      element.setIcon(IMG_OK);
      element.setTooltip(status.summary);
      break;
    case LOW:
      element.setIcon(IMG_LOW);
      element.setTooltip(summarizeIncidents(status.active));
      break;
    case MEDIUM:
      element.setIcon(IMG_MEDIUM);
      element.setTooltip(summarizeIncidents(status.active));
      break;
    case HIGH:
      element.setIcon(IMG_HIGH);
      element.setTooltip(summarizeIncidents(status.active));
      break;
    case ERROR:
    default:
      element.setIcon(IMG_ERROR);
      element.setTooltip(status.summary); // show error text
      break;
  }
}
 
Example #15
Source File: GoogleLoginCommandHandler.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
  IGoogleLoginService loginService =
      element.getServiceLocator().getService(IGoogleLoginService.class);
  boolean loggedIn = loginService.hasAccounts();

  element.setText(loggedIn ? Messages.getString("LOGIN_MENU_LOGGED_IN")
      : Messages.getString("LOGIN_MENU_LOGGED_OUT"));
}
 
Example #16
Source File: AdvancedFilterCommand.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes")
Map parameters){
	element.setIcon(Images.IMG_FILTER.getImageDescriptor());
}
 
Example #17
Source File: ShowHidenNonPrintingCharacterHandler.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
	element.setChecked(isSelected);
}
 
Example #18
Source File: FlatViewHandler.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void updateElement(UIElement element, Map parameters){
	boolean bFlat = CoreHub.userCfg.get(DocumentsView.SETTING_FLAT_VIEW, false);
	element.setChecked(bFlat);
}
 
Example #19
Source File: ShowHidenNonPrintingCharacterHandler.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
	element.setChecked(isSelected);
}
 
Example #20
Source File: ShowHidenNonPrintingCharacterHandler.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
	element.setChecked(isSelected);
}
 
Example #21
Source File: CancelRun.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setTooltip("Closes the current experiment (" + GamaKeyBindings.QUIT_STRING + ")");
	element.setText("Close Experiment (" + GamaKeyBindings.QUIT_STRING + ")");
}
 
Example #22
Source File: StepByStepHandler.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setTooltip("Runs the experiment one step at a time (" + GamaKeyBindings.STEP_STRING + ")");
	element.setText("Step Experiment (" + GamaKeyBindings.STEP_STRING + ")");
}
 
Example #23
Source File: TreatWarningsAsErrors.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setChecked(GamaPreferences.Runtime.CORE_WARNINGS.getValue());
}
 
Example #24
Source File: ErrorsPauseAndEdit.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setChecked(GamaPreferences.Runtime.CORE_REVEAL_AND_STOP.getValue());
}
 
Example #25
Source File: ShowErrors.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setChecked(GamaPreferences.Runtime.CORE_SHOW_ERRORS.getValue());
}
 
Example #26
Source File: ReloadSimulationHandler.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setTooltip("Reloads the current experiment (" + GamaKeyBindings.RELOAD_STRING + ")");
	element.setText("Reload Experiment (" + GamaKeyBindings.RELOAD_STRING + ")");
}
 
Example #27
Source File: ToggleMarkOccurrencesHandler.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
    boolean on = PreferenceKeys.PKEY_HIGHLIGHT_OCCURENCES.getStoredBoolean();
    element.setChecked(on);
}
 
Example #28
Source File: ShowGcpStatusHandler.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
  GcpStatusMonitoringService service = element.getServiceLocator().getService(GcpStatusMonitoringService.class);
  updateElement(element, parameters, service);
}
 
Example #29
Source File: ToggleSCTNatureAction.java    From statecharts with Eclipse Public License 1.0 2 votes vote down vote up
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {

	}