类org.eclipse.ui.menus.UIElement源码实例Demo

下面列出了怎么用org.eclipse.ui.menus.UIElement的API类实例代码及写法,或者点击链接到github查看源代码。

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"));
	}
}
 
源代码2 项目: tmxeditor8   文件: ChangeEditorLayoutHandler.java
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"));
	}
}
 
@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);
	}
}
 
@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"));
}
 
@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;
  }
}
 
源代码6 项目: tlaplus   文件: SwitchPerspectiveHandler.java
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);
        }
    }
}
 
源代码7 项目: gama   文件: PlayPauseSimulationHandler.java
@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 + ")");

}
 
源代码8 项目: translationstudio8   文件: OpenStatusBarHandler.java
@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"));
}
 
源代码9 项目: translationstudio8   文件: OpenToolBarHandler.java
@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"));
			}
		}
	});
	
}
 
源代码10 项目: translationstudio8   文件: OpenViewHandler.java
@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"));
			}
		}
	});
}
 
源代码11 项目: tmxeditor8   文件: OpenStatusBarHandler.java
@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"));
}
 
源代码12 项目: tmxeditor8   文件: OpenToolBarHandler.java
@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"));
			}
		}
	});
	
}
 
源代码13 项目: tmxeditor8   文件: OpenViewHandler.java
@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"));
			}
		}
	});
}
 
源代码14 项目: elexis-3-core   文件: LockStatusDialogHandler.java
@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);
	}
}
 
@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());
	}
}
 
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
  GcpStatusMonitoringService service = element.getServiceLocator().getService(GcpStatusMonitoringService.class);
  updateElement(element, parameters, service);
}
 
源代码17 项目: xds-ide   文件: ToggleMarkOccurrencesHandler.java
/**
 * {@inheritDoc}
 */
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
    boolean on = PreferenceKeys.PKEY_HIGHLIGHT_OCCURENCES.getStoredBoolean();
    element.setChecked(on);
}
 
源代码18 项目: gama   文件: ReloadSimulationHandler.java
@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 + ")");
}
 
源代码19 项目: gama   文件: ShowErrors.java
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setChecked(GamaPreferences.Runtime.CORE_SHOW_ERRORS.getValue());
}
 
源代码20 项目: gama   文件: ErrorsPauseAndEdit.java
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setChecked(GamaPreferences.Runtime.CORE_REVEAL_AND_STOP.getValue());
}
 
源代码21 项目: gama   文件: TreatWarningsAsErrors.java
@Override
public void updateElement(final UIElement element, final Map parameters) {
	element.setChecked(GamaPreferences.Runtime.CORE_WARNINGS.getValue());
}
 
源代码22 项目: gama   文件: StepByStepHandler.java
@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 + ")");
}
 
源代码23 项目: gama   文件: CancelRun.java
@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 + ")");
}
 
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
	element.setChecked(isSelected);
}
 
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
	element.setChecked(isSelected);
}
 
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
	element.setChecked(isSelected);
}
 
源代码27 项目: elexis-3-core   文件: FlatViewHandler.java
@Override
public void updateElement(UIElement element, Map parameters){
	boolean bFlat = CoreHub.userCfg.get(DocumentsView.SETTING_FLAT_VIEW, false);
	element.setChecked(bFlat);
}
 
源代码28 项目: elexis-3-core   文件: AdvancedFilterCommand.java
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes")
Map parameters){
	element.setIcon(Images.IMG_FILTER.getImageDescriptor());
}
 
源代码29 项目: statecharts   文件: ToggleSCTNatureAction.java
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {

	}
 
 类所在包
 同包方法