Java 类org.eclipse.debug.core.ILaunchMode 实例源码

项目:google-cloud-eclipse    文件:LaunchModes.java   
@Override
@SuppressWarnings("rawtypes")
public Map getParameterValues() {
  ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
  Map<String, String> modes = new HashMap<>();
  for (String modeId : LocalAppEngineServerLaunchConfigurationDelegate.SUPPORTED_LAUNCH_MODES) {
    ILaunchMode mode = manager.getLaunchMode(modeId);
    if (mode != null) {
      // label is intended to be shown in menus and buttons and often has
      // embedded '&' for mnemonics, which isn't useful here
      String label = mode.getLabel();
      label = label.replace("&", "");
      modes.put(label, mode.getIdentifier());
    }
  }
  return modes;
}
项目:eclipse-extras    文件:LaunchModeActionComparator.java   
private static int compare( ILaunchMode launchMode1, ILaunchMode launchMode2 ) {
  int result;
  if( isRunMode( launchMode1 ) ) {
    result = -1;
  } else if( isRunMode( launchMode2 ) ) {
    result = 1;
  } else if( isDebugMode( launchMode1 ) ) {
    if( isRunMode( launchMode2 ) ) {
      result = 1;
    } else {
      result = -1;
    }
  } else if( isDebugMode( launchMode2 ) ) {
    if( isRunMode( launchMode1 ) ) {
      result = -1;
    } else {
      result = 1;
    }
  } else {
    result = launchMode1.getLabel().compareTo( launchMode2.getLabel() );
  }
  return result;
}
项目:eclipse-extras    文件:LaunchConfigStarter.java   
public LaunchConfigStarter( DebugUIPreferences preferences,
                            ILaunchMode launchMode,
                            ILaunchConfiguration... launchConfigs )
{
  this.preferences = requireNonNull( preferences );
  this.preferredLaunchMode = requireNonNull( launchMode );
  this.launchConfigs = launchConfigs;
}
项目:eclipse-extras    文件:LaunchConfigValidator.java   
private IStatus validateExistingLaunchConfig() {
  IStatus result = okStatus();
  ILaunchMode launchMode = computeActualLaunchMode();
  if( launchMode == null ) {
    result = new Status( ERROR, PLUGIN_ID, 0, NO_LAUNCH_MODE_FOUND, null );
  } else if( !preferredLaunchMode.getIdentifier().equals( launchMode.getIdentifier() ) ) {
    result = new Status( INFO, PLUGIN_ID, INFO, getLaunchModeWarningMessage( launchMode ), null );
  }
  return result;
}
项目:eclipse-extras    文件:LaunchModeComputer.java   
public ILaunchMode computeLaunchMode() {
  ILaunchMode result;
  if( isLaunchModeSupported( preferredLaunchMode ) ) {
    result = preferredLaunchMode;
  } else {
    result = findAlternativeLaunchMode();
  }
  return result;
}
项目:eclipse-extras    文件:LaunchModeComputer.java   
public ILaunchGroup computeLaunchGroup() {
  ILaunchGroup result = null;
  ILaunchMode launchMode = computeLaunchMode();
  if( launchMode != null ) {
    result = DebugUITools.getLaunchGroup( launchConfig, launchMode.getIdentifier() );
  }
  return result;
}
项目:eclipse-extras    文件:LaunchModeComputer.java   
private boolean isLaunchModeSupported( ILaunchMode launchMode ) {
  try {
    return launchMode != null && launchConfig.supportsMode( launchMode.getIdentifier() );
  } catch( CoreException ignore ) {
    return false;
  }
}
项目:eclipse-extras    文件:LaunchSelectionDialog.java   
private void updateOkButtonLabel() {
  Button okButton = getButton( OK_ID );
  LaunchModeSetting launchModeSetting = new LaunchModeSetting( launchManager, getDialogSettings() );
  ILaunchMode launchMode = launchModeSetting.getLaunchMode();
  if( okButton != null && launchMode != null ) {
    okButton.setText( launchMode.getLabel() );
    okButton.getParent().layout();
  }
}
项目:eclipse-extras    文件:LaunchModeSettingTest.java   
@Test
public void testDefaultLaunchMode() {
  ILaunchMode debug = createLaunchMode( DEBUG_MODE );
  setSupportedLaunchModes( debug );

  String launchModeId = launchModeSetting.getLaunchModeId();

  assertThat( launchModeId ).isEqualTo( DEBUG_MODE );
}
项目:eclipse-extras    文件:LaunchModeSettingTest.java   
@Test
public void testSetLaunchMode() {
  ILaunchMode debug = createLaunchMode( DEBUG_MODE );
  ILaunchMode run = createLaunchMode( RUN_MODE );
  setSupportedLaunchModes( debug, run );

  launchModeSetting.setLaunchModeId( RUN_MODE );

  assertThat( launchModeSetting.getLaunchModeId() ).isEqualTo( RUN_MODE );
}
项目:eclipse-extras    文件:LaunchModeSettingTest.java   
@Test
public void testGetUnknownLaunchMode() {
  ILaunchMode debug = createLaunchMode( DEBUG_MODE );
  setSupportedLaunchModes( debug );

  launchModeSetting.setLaunchModeId( RUN_MODE );

  assertThat( launchModeSetting.getLaunchModeId() ).isEqualTo( DEBUG_MODE );
}
项目:eclipse-extras    文件:LaunchModeComputerPDETest.java   
@Test
public void testComputeLaunchModeWithSupportedMode() {
  ILaunchMode supportedMode = getSupportedMode();

  ILaunchMode launchMode = computeLaunchMode( supportedMode );

  assertThat( launchMode ).isEqualTo( supportedMode );
}
项目:eclipse-extras    文件:LaunchModeComputerPDETest.java   
@Test
public void testComputeLaunchModeWithUnsupportedMode() {
  ILaunchMode unsupportedMode = getUnsupportedMode();

  ILaunchMode launchMode = computeLaunchMode( unsupportedMode );

  assertThat( launchMode ).isEqualTo( getSupportedMode() );
}
项目:eclipse-extras    文件:LaunchModeComputerPDETest.java   
@Test
public void testComputeLaunchModeWithDeletedLaunchConfig() throws CoreException {
  ILaunchMode supportedMode = getSupportedMode();
  ILaunchConfiguration deletedLaunchConfig = launchConfig.doSave();
  deletedLaunchConfig.delete();

  ILaunchMode launchMode = new LaunchModeComputer( deletedLaunchConfig, supportedMode ).computeLaunchMode();

  assertThat( launchMode ).isNull();
}
项目:eclipse-extras    文件:LaunchModeComputerPDETest.java   
@Test
public void testComputeLaunchGroupWithSupportedMode() {
  ILaunchMode supportedMode = getSupportedMode();

  ILaunchGroup launchMode = computeLaunchGroup( supportedMode );

  assertThat( launchMode.getMode() ).isEqualTo( supportedMode.getIdentifier() );
}
项目:eclipse-extras    文件:LaunchModeComputerPDETest.java   
@Test
public void testComputeLaunchGroupWithUnsupportedMode() {
  ILaunchMode unsupportedMode = getUnsupportedMode();

  ILaunchGroup launchMode = computeLaunchGroup( unsupportedMode );

  assertThat( launchMode.getMode() ).isEqualTo( getSupportedMode().getIdentifier() );
}
项目:eclipse-extras    文件:LaunchModeComputerPDETest.java   
@Test
public void testComputeLaunchGroupWithDeletedLaunchConfig() throws CoreException {
  ILaunchMode supportedMode = getSupportedMode();
  ILaunchConfiguration deletedLaunchConfig = launchConfig.doSave();
  deletedLaunchConfig.delete();

  ILaunchGroup launchGroup = new LaunchModeComputer( deletedLaunchConfig, supportedMode ).computeLaunchGroup();

  assertThat( launchGroup ).isNull();
}
项目:eclipse-extras    文件:LaunchConfigComparatorPDETest.java   
private int compare( ILaunchConfiguration launchConfig1,
                     ILaunchConfiguration launchConfig2,
                     String mode )
{
  ILaunchMode launchMode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode( mode );
  LaunchConfigComparator comparator = new LaunchConfigComparator( launchConfigHistory, launchMode );
  return comparator.compare( launchConfig1, launchConfig2 );
}
项目:eclipse-extras    文件:LaunchModeDropDownActionTest.java   
@Before
public void setUp() {
  launchManager = mock( ILaunchManager.class );
  when( launchManager.getLaunchModes() ).thenReturn( new ILaunchMode[ 0 ] );
  DialogSettings dialogSettings = new DialogSettings( "section-name" );
  launchModeSetting = new LaunchModeSetting( launchManager, dialogSettings );
}
项目:eclipse-extras    文件:LaunchModeDropDownActionTest.java   
@Test
public void testGetMenuForMenu() {
  ILaunchMode run = createLaunchMode( RUN_MODE );
  ILaunchMode debug = createLaunchMode( DEBUG_MODE );
  when( launchManager.getLaunchModes() ).thenReturn( new ILaunchMode[]{ run, debug } );
  LaunchModeDropDownAction action = new LaunchModeDropDownAction( launchModeSetting );

  Menu menu = action.getMenu( new Menu( displayHelper.createShell() ) );

  assertThat( menu.getItemCount() ).isEqualTo( 2 );
  assertThat( menu.getItem( 0 ).getText() ).isNotEmpty();
  assertThat( menu.getItem( 0 ).getImage() ).isNull();
}
项目:eclipse-extras    文件:LaunchModeDropDownActionTest.java   
@Test
public void testDispose() {
  ILaunchMode run = createLaunchMode( RUN_MODE );
  when( launchManager.getLaunchModes() ).thenReturn( new ILaunchMode[]{ run } );
  LaunchModeDropDownAction action = new LaunchModeDropDownAction( launchModeSetting );
  Menu menu = action.getMenu( new Menu( displayHelper.createShell() ) );

  action.dispose();

  assertThat( menu.isDisposed() ).isTrue();
}
项目:eclipse-extras    文件:LaunchModeActionComparatorTest.java   
private LaunchModeAction addLaunchMode( String identifier, String label ) {
  ILaunchMode launchMode = createLaunchMode( identifier, label );
  LaunchModeAction launchModeAction = mock( LaunchModeAction.class );
  when( launchModeAction.getLaunchMode() ).thenReturn( launchMode );
  launchModes.add( launchModeAction );
  return launchModeAction;
}
项目:lcdsl    文件:LcDslLaunchObject.java   
@Override
public void launch(ILaunchMode mode) {
    StandaloneLaunchConfigExecutor.launchProcess(generator.generate(cfg), mode.getIdentifier(), true, false, null);
}
项目:eclipse-extras    文件:EditLaunchConfigAction.java   
private String getLaunchGroupId( ILaunchConfiguration launchConfig ) {
  ILaunchMode preferredLaunchMode = launchSelectionDialog.getLaunchMode();
  LaunchModeComputer launchModeComputer = new LaunchModeComputer( launchConfig, preferredLaunchMode );
  ILaunchGroup launchGroup = launchModeComputer.computeLaunchGroup();
  return launchGroup == null ? null : launchGroup.getIdentifier();
}
项目:eclipse-extras    文件:LaunchModeAction.java   
public LaunchModeAction( LaunchModeSetting launchModeSetting, ILaunchMode launchMode ) {
  super( launchMode.getLabel(), IAction.AS_RADIO_BUTTON );
  this.launchModeSetting = launchModeSetting;
  this.launchMode = launchMode;
  update();
}
项目:eclipse-extras    文件:LaunchModeAction.java   
public ILaunchMode getLaunchMode() {
  return launchMode;
}
项目:eclipse-extras    文件:LaunchConfigStarter.java   
public LaunchConfigStarter( ILaunchMode launchMode, ILaunchConfiguration... launchConfigs ) {
  this( new DebugUIPreferences(), launchMode, launchConfigs );
}
项目:eclipse-extras    文件:LaunchConfigStarter.java   
private void startLaunchConfig( ILaunchConfiguration launchConfig ) {
  ILaunchMode launchMode = new LaunchModeComputer( launchConfig, preferredLaunchMode ).computeLaunchMode();
  DebugUITools.launch( launchConfig, launchMode.getIdentifier() );
}
项目:eclipse-extras    文件:LaunchConfigValidator.java   
public LaunchConfigValidator( ILaunchConfiguration launchConfig, ILaunchMode preferredLaunchMode ) {
  requireNonNull( launchConfig, "launchConfig" );
  this.launchConfig = launchConfig;
  this.preferredLaunchMode = preferredLaunchMode;
}
项目:eclipse-extras    文件:LaunchConfigValidator.java   
private ILaunchMode computeActualLaunchMode() {
  return new LaunchModeComputer( launchConfig, preferredLaunchMode ).computeLaunchMode();
}
项目:eclipse-extras    文件:LaunchConfigValidator.java   
private static String getLaunchModeWarningMessage( ILaunchMode launchMode ) {
  String label = launchMode.getLabel().replace( "&", "" );
  return format( "Selection will be launched in ''{0}'' mode", label );
}
项目:eclipse-extras    文件:OpenLaunchDialogHander.java   
private static void startLaunchConfigs( ILaunchMode launchMode,
                                        ILaunchConfiguration[] launchConfigs )
{
  new LaunchConfigStarter( launchMode, launchConfigs ).start();
}
项目:eclipse-extras    文件:LaunchModeDropDownAction.java   
private LaunchModeAction createLaunchModeAction( ILaunchMode launchMode ) {
  LaunchModeAction result = new LaunchModeAction( launchModeSetting, launchMode );
  result.addPropertyChangeListener( this::launchModeActionPropertyChanged );
  return result;
}
项目:eclipse-extras    文件:LaunchModeActionComparator.java   
private static boolean isRunMode( ILaunchMode launchMode ) {
  return RUN_MODE.equals( launchMode.getIdentifier() );
}
项目:eclipse-extras    文件:LaunchModeActionComparator.java   
private static boolean isDebugMode( ILaunchMode launchMode ) {
  return DEBUG_MODE.equals( launchMode.getIdentifier() );
}
项目:eclipse-extras    文件:LaunchModeComputer.java   
public LaunchModeComputer( ILaunchConfiguration launchConfig, ILaunchMode preferredLaunchMode ) {
  requireNonNull( launchConfig, "launchConfig" );
  this.launchConfig = launchConfig;
  this.preferredLaunchMode = preferredLaunchMode;
}
项目:eclipse-extras    文件:LaunchModeComputer.java   
private ILaunchMode findAlternativeLaunchMode() {
  return Stream.of( allLaunchModes() ).filter( this::isLaunchModeSupported ).findFirst().orElse( null );
}
项目:eclipse-extras    文件:LaunchModeComputer.java   
private static ILaunchMode[] allLaunchModes() {
  return DebugPlugin.getDefault().getLaunchManager().getLaunchModes();
}
项目:eclipse-extras    文件:LaunchSelectionDialog.java   
public ILaunchMode getLaunchMode() {
  return new LaunchModeSetting( launchManager, getDialogSettings() ).getLaunchMode();
}
项目:eclipse-extras    文件:LaunchSelectionDialog.java   
@Override
protected IStatus validateItem( Object item ) {
  ILaunchMode preferredLaunchMode = getLaunchMode();
  ILaunchConfiguration launchConfig = ( ILaunchConfiguration )item;
  return new LaunchConfigValidator( launchConfig, preferredLaunchMode ).validate();
}