Exemple #1
0
  private void updateWlanLibraryStatus() {
    if (!wlanLibrary.isReady()) {
      for (Label ssidStatus : toolbarSsidLibraryLabels) {
        ssidStatus.setText("エラー");
        ssidStatus.setForeground(colorRegistry.get(COLOR_NG));

        ssidStatus.getParent().getParent().layout();
      }
    } else if (wlanLibrary instanceof WlanProxyLibrary) {
      for (Label ssidStatus : toolbarSsidLibraryLabels) {
        ssidStatus.setText("プロキシ");
        ssidStatus.setForeground(colorRegistry.get(COLOR_NG));

        ssidStatus.getParent().getParent().layout();
      }
    } else if (wlanLibrary.isSSIDEnabled()) {
      for (Label ssidStatus : toolbarSsidLibraryLabels) {
        ssidStatus.setText("On");
        ssidStatus.setForeground(colorRegistry.get(COLOR_APP_NUMBER));

        ssidStatus.getParent().getParent().layout();
      }
    } else {
      for (Label ssidStatus : toolbarSsidLibraryLabels) {
        ssidStatus.setText("Off");
        ssidStatus.setForeground(colorRegistry.get(COLOR_OK));

        ssidStatus.getParent().getParent().layout();
      }
    }
  }
 private void updateURLEnabled(ILaunchConfiguration configuration) throws CoreException {
   boolean enabled = configuration.getAttribute(SERVER_ENABLED, true);
   fURLLabel.getParent().setVisible(enabled);
   if (enabled) {
     fURLPath.setEnabled(!autoGeneratedURL.getSelection());
   }
 }
 /**
  * The user has modified the comma-separated list of config suffixes. Validate the input and
  * update the "Add" button enablement and error label accordingly.
  */
 private void handleSuffixesTextModified() {
   String errorMessage = null;
   Set<String> suffixes = new LinkedHashSet<String>();
   String extText = suffixesText.getText().trim();
   if (extText.length() == 0) {
     errorMessage = BeansUIPlugin.getResourceString(ERROR_NO_SUFFIXES);
   } else {
     StringTokenizer tokenizer = new StringTokenizer(extText, ",");
     while (tokenizer.hasMoreTokens()) {
       String suffix = tokenizer.nextToken().trim();
       if (isValidSuffix(suffix)) {
         suffixes.add(suffix);
       } else {
         errorMessage = BeansUIPlugin.getResourceString(ERROR_INVALID_SUFFIXES);
         break;
       }
     }
     if (errorMessage == null) {
       project.setConfigSuffixes(suffixes);
       hasUserMadeChanges = true;
     }
   }
   if (errorMessage != null) {
     errorLabel.setText(errorMessage);
     addButton.setEnabled(false);
   } else {
     errorLabel.setText("");
     addButton.setEnabled(true);
   }
   errorLabel.getParent().update();
 }
 private void refontLabel(boolean dye) {
   FontData fontData = label.getFont().getFontData()[0];
   Font font;
   int color;
   if (dye) {
     font =
         new Font(
             label.getParent().getDisplay(),
             new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
     color = SWT.COLOR_RED;
   } else {
     font =
         new Font(
             label.getParent().getDisplay(),
             new FontData(fontData.getName(), fontData.getHeight(), SWT.NONE));
     color = SWT.COLOR_WIDGET_FOREGROUND;
   }
   label.setForeground(label.getParent().getDisplay().getSystemColor(color));
   label.setFont(font);
 }
  protected String checkValidPackage(String text) {
    validatedPackage = null;
    packageText = null;
    // there is a chance that the package is the default project, so, the validation below may not
    // be valid.
    // if(text == null || text.trim().length() == 0 ){
    // }
    String initialText = text;

    if (text.indexOf('/') != -1) {
      labelWarningImageWillCreate.setVisible(false);
      labelWarningWillCreate.setVisible(false);
      labelWarningWillCreate.getParent().layout();
      return "The package name must not contain '/'.";
    }
    if (text.indexOf('\\') != -1) {
      labelWarningImageWillCreate.setVisible(false);
      labelWarningWillCreate.setVisible(false);
      labelWarningWillCreate.getParent().layout();
      return "The package name must not contain '\\'.";
    }
    if (text.endsWith(".")) {
      labelWarningImageWillCreate.setVisible(false);
      labelWarningWillCreate.setVisible(false);
      labelWarningWillCreate.getParent().layout();
      return "The package may not end with a dot";
    }
    text = text.replace('.', '/');
    if (validatedSourceFolder == null) {
      labelWarningImageWillCreate.setVisible(false);
      labelWarningWillCreate.setVisible(false);
      labelWarningWillCreate.getParent().layout();
      return "The source folder was not correctly validated.";
    }

    IPath path = validatedSourceFolder.getFullPath().append(text);
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IResource resource = root.findMember(path);
    if (resource == null) {
      packageText = initialText;
      labelWarningImageWillCreate.setVisible(true);
      labelWarningWillCreate.setVisible(true);
      labelWarningWillCreate.getParent().layout();

      return null;
    }
    labelWarningImageWillCreate.setVisible(false);
    labelWarningWillCreate.setVisible(false);
    labelWarningWillCreate.getParent().layout();

    if (!(resource instanceof IContainer)) {
      return "The resource found for the package is not a valid container.";
    }
    if (!resource.exists()) {
      return "The package selected does not exist in the filesystem.";
    }
    validatedPackage = (IContainer) resource;
    return null;
  }
  void configureAssetType(AssetType type) {
    showGroup(type.needsForegroundScaling(), mScalingLabel, mScalingComposite);
    showGroup(type.needsShape(), mShapeLabel, mShapeComposite);
    showGroup(type.needsTheme(), mThemeLabel, mThemeComposite);
    showGroup(type.needsColors(), mBgColorLabel, mBgButton);
    showGroup(type.needsColors(), mFgColorLabel, mFgButton);
    if (SUPPORT_LAUNCHER_ICON_TYPES) {
      showGroup(type.needsEffects(), mEffectsLabel, mEffectsComposite);
    }

    Composite parent = mScalingLabel.getParent();
    parent.pack();
    parent.layout();
  }
  private void updateCount() {
    if (fCountTotal <= 0) {
      // Since we filter the list of available plug-ins the total may differ from the model count
      fCountTotal = fAvailableListViewer.getTable().getItemCount();
    }

    fCountLabel.setText(
        NLS.bind(
            PDEUIMessages.ImportWizard_DetailedPage_count,
            (new String[] {
              Integer.toString(fImportListViewer.getTable().getItemCount()),
              Integer.toString(fCountTotal)
            })));
    fCountLabel.getParent().layout();
  }
  private void updateSliceWidget(String path) {
    try {
      IDataHolder dh = ServiceHolder.getLoaderService().getData(path, new IMonitor.Stub());
      ILazyDataset lazy = dh.getLazyDataset(fileManager.getContext().getDatasetNames().get(0));
      int[] shape = lazy.getShape();

      int[] dd = Slicer.getDataDimensions(shape, fileManager.getContext().getSliceDimensions());
      Slice[] slices =
          Slicer.getSliceArrayFromSliceDimensions(
              fileManager.getContext().getSliceDimensions(), shape);
      csw.setDatasetShapeInformation(shape, dd.clone(), slices);
      String ss = Slice.createString(csw.getCurrentSlice());
      currentSliceLabel.setText("Current slice of data: [" + ss + "]");
      currentSliceLabel.getParent().layout(true);
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
  }
  private void showMenu() {
    Menu menu = new Menu(getShell(), POP_UP);
    addMenuItem(menu, TransformComponent.class);
    addSeparator(menu);
    addMenuItem(menu, BulletRigidBodyComponent.class);
    addSeparator(menu);
    addMenuItem(menu, OrtographicCameraComponent.class);
    addMenuItem(menu, PerspectiveCameraComponent.class);
    addSeparator(menu);
    addMenuItem(menu, DirectionalLightComponent.class);
    addMenuItem(menu, PointLightComponent.class);
    addMenuItem(menu, SpotLightComponent.class);
    addSeparator(menu);
    addMenuItem(menu, AudioListenerComponent.class);
    addMenuItem(menu, AudioSourceComponent.class);
    addSeparator(menu);
    addMenuItem(menu, TagComponent.class);
    addSeparator(menu);
    addMenuItem(menu, TextureComponent.class);
    addMenuItem(menu, TextureRegionComponent.class);
    addMenuItem(menu, AtlasRegionComponent.class);
    addMenuItem(menu, SkyboxComponent.class);
    addSeparator(menu);
    addMenuItem(menu, ModelComponent.class);
    addMenuItem(menu, ShapeComponent.class);
    addSeparator(menu);
    addMenuItem(menu, TestPropertyEditorsComponent.class);
    addMenuItem(menu, TestEditorComponent.class);
    addMenuItem(menu, TestInputComponent.class);
    addMenuItem(menu, TestTypeSelectionComponnent.class);
    addMenuItem(menu, TestArrayEditorComponent.class);
    addSeparator(menu);
    addScriptMenuItem(menu);

    Point buttonLocation = menuButton.getLocation();
    Rectangle rect = menuButton.getBounds();
    Point menuLocation = new Point(buttonLocation.x - 1, buttonLocation.y + rect.height);

    menu.setLocation(getDisplay().map(menuButton.getParent(), null, menuLocation));
    menu.setVisible(true);
  }
  public void updateTextClient(
      Section section, final PatchSetDetail patchSetDetail, boolean cachingInProgress) {
    String message;

    String time =
        DateFormat.getDateTimeInstance().format(patchSetDetail.getPatchSet().getCreatedOn());
    int numComments = getNumComments(patchSetDetail);
    if (numComments > 0) {
      message = NLS.bind("{0}, {1} Comments", time, numComments);
    } else {
      message = NLS.bind("{0}", time);
    }

    if (cachingInProgress) {
      message += " [Caching contents...]";
    }

    final Label textClientLabel = (Label) section.getTextClient();
    textClientLabel.setText("  " + message);
    textClientLabel.getParent().layout(true, true);
    // textClientLabel.setVisible(cachingInProgress || !section.isExpanded());
  }
Exemple #11
0
 /**
  * set the gprof view title
  *
  * @param decoder the gmon decoder
  * @param titleLabel the title label
  */
 private static void setHistTitle(GmonDecoder decoder, Label titleLabel) {
   String title =
       " gmon file: " //$NON-NLS-1$
           + decoder.getGmonFile()
           + "\n program file: " //$NON-NLS-1$
           + decoder.getProgram().getPath()
           + "\n" //$NON-NLS-1$
           + " timestamp: "
           + decoder.getGmonFileTimeStamp(); // $NON-NLS-1$
   HistogramDecoder histo = decoder.getHistogramDecoder();
   if (histo.hasValues()) {
     double prof_rate = histo.getProfRate();
     String period = ""; // $NON-NLS-1$
     if (prof_rate != 0) {
       char tUnit = histo.getTimeDimension();
       switch (tUnit) {
         case 's':
           prof_rate /= 1000000000;
           break;
         case 'm':
           prof_rate /= 1000000;
           break;
         case 'u':
           prof_rate /= 1000;
           break;
       }
       period = ", each sample counts as " + SampleProfField.getValue(1, prof_rate); // $NON-NLS-1$
     }
     title +=
         "\n "
             + histo.getBucketSize() // $NON-NLS-1$
             + " bytes per bucket"
             + period; //$NON-NLS-1$
   }
   titleLabel.setText(title);
   titleLabel.getParent().layout(true);
 }
 private void updateLabel(AbstractWorkflowArtifact sma) throws OseeCoreException {
   valueLabel.setText(getEstHoursStr());
   valueLabel.getParent().layout();
 }