Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.ColorDialog


   * @return the changed color
   */
  public static Color editColor(Color color) {
    if (color != null && color.eContainer() instanceof Diagram) {
      Shell shell = getShell();
      ColorDialog colorDialog = new ColorDialog(shell);
      colorDialog.setText("Choose Color");
      colorDialog.setRGB(new RGB(color.getRed(), color.getGreen(), color.getBlue()));

      RGB retRgb = colorDialog.open();
      if (retRgb == null) {
        return null;
      }

      Diagram diagram = (Diagram) color.eContainer();
View Full Code Here


        colorLabel.addListener(SWT.MouseDoubleClick, new Listener() {
            public void handleEvent(Event e) {

                //Choose color
                ColorDialog colorDialog1 = new ColorDialog(colorLabel.getShell());
                colorDialog1.setText("Choose Color for Client");
                colorDialog1.setRGB(colorLabel.getBackground().getRGB());
                RGB selectedColor = colorDialog1.open();

                if(selectedColor != null){
                    Color color = new Color(Plugin.getDisplay(),
                            selectedColor.red,
                            selectedColor.green,
                            selectedColor.blue);
                    colorLabel.setBackground(color);
                    color.dispose();
                    String newColorString = "r"+colorLabel.getBackground().getRed() + "g" + colorLabel.getBackground().getGreen() + "b" + colorLabel.getBackground().getBlue();
                    PluginConfig config = Plugin.getPluginInterface().getPluginconfig();
                    config.setPluginParameter("Stuffer_Block_Mods_Color",newColorString);
                    try {
                        config.save();
                    } catch (PluginException e1) {

                        e1.printStackTrace();
                    }

                }

            }
        });

        Label MOD_block_label = new Label(modBlockComp,SWT.NULL);
        MOD_block_label.setText("     Total Blocks: ");

        MOD_block_num = new Label (modBlockComp,SWT.NULL);
        MOD_block_num.setText(String.valueOf(Constants.MOD_CLIENT_BLOCKS));


        //second rule
        //-------------

        final Button badBlockButton = new Button(modBlockComp,SWT.CHECK);
        badBlockButton.setText("Force Stuffer to block ALL seeds (Allows downloading from only peers)");

        //set the selection to the user preferences
        badBlockButton.setSelection(Plugin.getPluginInterface().getPluginconfig().getPluginBooleanParameter("Stuffer_Block_Seeder",false));



        //listener for button
        badBlockButton.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event e) {
                try {
                    PluginConfig config = Plugin.getPluginInterface().getPluginconfig();
                    config.setPluginParameter("Stuffer_Block_Seeder",badBlockButton.getSelection());
                    config.save();

                } catch (PluginException e1) {
                    e1.printStackTrace();
                }
            }
        });

        final Label colorLabel_bad = new Label(modBlockComp,SWT.BORDER);
        gridData = new GridData(GridData.BEGINNING);
        gridData.widthHint = 20;
        colorLabel_bad.setLayoutData(gridData);

        colorLabel_bad.setToolTipText("Double click to change the color");

        //Set Initial Color
        RGB rgb_bad = Utils.getRGB(Plugin.getPluginInterface().getPluginconfig().getPluginStringParameter("Stuffer_Block_Bad_Color","r0g255b0"));
        Color color_bad = new Color(Plugin.getDisplay(),rgb_bad);
        colorLabel_bad.setBackground(color_bad);
        color_bad.dispose();

        colorLabel_bad.addListener(SWT.MouseDoubleClick, new Listener() {
            public void handleEvent(Event e) {

                //Choose color
                ColorDialog colorDialog1 = new ColorDialog(colorLabel_bad.getShell());
                colorDialog1.setText("Choose Color for Client");
                colorDialog1.setRGB(colorLabel_bad.getBackground().getRGB());
                RGB selectedColor = colorDialog1.open();

                if(selectedColor != null){
                    Color color = new Color(Plugin.getDisplay(),
                            selectedColor.red,
                            selectedColor.green,
View Full Code Here

            final Button color_choose = new Button(color_comp,SWT.PUSH);
            color_choose.setText("Choose Color for Client");
            color_choose.addListener(SWT.Selection, new Listener() {
              public void handleEvent(Event e) {
                //Choose color
                ColorDialog colorDialog1 = new ColorDialog(shell);
                colorDialog1.setText("Choose Color for Client");
                colorDialog1.setRGB(new RGB(0,0,0));
                RGB selectedColor = colorDialog1.open();

                if(selectedColor != null){
                  Color color = new Color(Plugin.getDisplay(),
                      selectedColor.red,
                      selectedColor.green,
View Full Code Here

         colorLabel.addListener(SWT.MouseDoubleClick, new Listener() {
           public void handleEvent(Event e) {
             //Choose color
             Plugin.getTab2().getClientTable().setSelection(item_number);
             ColorDialog colorDialog1 = new ColorDialog(colorLabel.getShell());
             colorDialog1.setText("Choose Color for Client");
             colorDialog1.setRGB(colorLabel.getBackground().getRGB());
             RGB selectedColor = colorDialog1.open();

             if(selectedColor != null){
               String position = item.getText(0);
               position = stringNumberDownOne(position);
               String clientName = item.getText(1);
View Full Code Here

    return 3;
  }

  @Override
  public boolean show() {
    ColorDialog dialog = new ColorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
    RGB rgb = dialog.open();
    if (rgb != null) {
      proposal = "rgb("+rgb.red+","+rgb.green+","+rgb.blue+")";
      return true;
    }
    else {
View Full Code Here

  public PaintProposalProvider() {
    proposals.add(new DialogProposal(601, "Pick color ...") {

      @Override
      public String openProposal() {
        ColorDialog dialog = new ColorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
        RGB rgb = dialog.open();
        if (rgb != null) {
          String r = Integer.toHexString(rgb.red);
          r = r.length() == 1 ? "0"+r : r;
         
          String g = Integer.toHexString(rgb.green);
View Full Code Here

        return 2;
      }
     
      @Override
      public String openDialogValue() {
        ColorDialog dialog = new ColorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
        RGB rgb = dialog.open();
        if( rgb != null ) {
          return "rgb("+rgb.red+","+rgb.green+","+rgb.blue+")";
        }
        return null;
      }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.ColorDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.