Package org.eclipse.e4.ui.model.application.ui.basic

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart


  }

  @Override
  public ServerResource create(Class<? extends ServerResource> clazz, Request request, Response response)
  {
    IEclipseContext childContext = serviceContext.createChild("ResourceContext");
    diLock.lock(); // The lock is required because ContextInjectionFactory.make() is not thread safe

    try
    {
      InjectedResource serverResource = (InjectedResource) ContextInjectionFactory.make(clazz, childContext);
View Full Code Here


  @Execute
  public void onExecute() {
    eventBroker.subscribe(IThemeEngine.Events.THEME_CHANGED,
        new EventHandler() {
          public void handleEvent(Event event) {
            ITheme currentTheme = (ITheme) event
                .getProperty(IThemeEngine.Events.THEME);
            // if (!prefDarker.getBoolean(
            // THEME_DARKER_PREF_THEMEENABLED, false))
            if (currentTheme.getId().equals(THEME_DARKER_ID)) {
              setupPreferences();
              isLastThemeDarker = true;
              DarkerWeavingHook.enableWeaving();
              hookDarkerCore();
            } else if (isLastThemeDarker) {
View Full Code Here

    {
        NewClientWizard wizard = new NewClientWizard();
        WizardDialog dialog = new WizardDialog(shell, wizard);
        if (dialog.open() == Window.OK)
        {
            MPart part = partService.createPart(UIConstants.Part.PORTFOLIO);
            part.setLabel(Messages.LabelUnnamedXml);
            part.getTransientData().put(Client.class.getName(), wizard.getClient());

            MPartStack stack = (MPartStack) modelService.find(UIConstants.PartStack.MAIN, app);
            stack.getChildren().add(part);

            partService.showPart(part, PartState.ACTIVATE);
View Full Code Here

            MessageDialog.openError(shell, Messages.LabelError,
                            MessageFormat.format(Messages.MsgErrorOpeningFile, logfile.getAbsoluteFile()));
        }
        else
        {
            MPart part = partService.createPart(UIConstants.Part.TEXT_VIEWER);
            part.getPersistedState().put(UIConstants.Parameter.FILE, logfile.getAbsolutePath());

            MPartStack stack = (MPartStack) modelService.find(UIConstants.PartStack.MAIN, app);
            stack.getChildren().add(part);

            partService.showPart(part, PartState.ACTIVATE);
View Full Code Here

        dialog.setFilterNames(new String[] { Messages.LabelPortfolioPerformanceFile });
        String fileSelected = dialog.open();

        if (fileSelected != null)
        {
            MPart part = partService.createPart(UIConstants.Part.PORTFOLIO);
            part.setLabel(new File(fileSelected).getName());
            part.setTooltip(fileSelected);
            part.getPersistedState().put(UIConstants.Parameter.FILE, fileSelected);

            MPartStack stack = (MPartStack) modelService.find(UIConstants.PartStack.MAIN, app);
            stack.getChildren().add(part);

            partService.showPart(part, PartState.ACTIVATE);
View Full Code Here

public class OpenPartHandler
{
    @Execute
    public void execute(EPartService partService, @Named(UIConstants.Parameter.PART) String partname)
    {
        MPart part = partService.findPart(partname);
        part.setVisible(true);
        partService.activate(part, true);
    }
View Full Code Here

                        sync.asyncExec(new Runnable()
                        {
                            @Override
                            public void run()
                            {
                                MPart part = partService.createPart(UIConstants.Part.PORTFOLIO);
                                part.setLabel(sampleFile.substring(sampleFile.lastIndexOf('/') + 1));
                                part.getTransientData().put(Client.class.getName(), client);

                                MPartStack stack = (MPartStack) modelService.find(UIConstants.PartStack.MAIN, app);
                                stack.getChildren().add(part);

                                partService.showPart(part, PartState.ACTIVATE);
View Full Code Here

    private static final class PartLabelProvider extends LabelProvider
    {
        @Override
        public String getText(Object element)
        {
            MPart part = (MPart) element;
            String tooltip = part.getTooltip();
            return tooltip != null ? part.getLabel() + " (" + part.getTooltip() + ")" : part.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$
        }
View Full Code Here

            return;
          }
        }
      }
     
      MPart p = MBasicFactory.INSTANCE.createPart();
      p.setLabel(m.getName());
      if( m.getType() == MediaType.MOVIE ) {
        p.setIconURI("platform:/plugin/at.bestsolution.efxclipse.runtime.examples.media/icons/22/kaffeine.png")
      } else if( m.getType() == MediaType.PICTURE ) {
        p.setIconURI("platform:/plugin/at.bestsolution.efxclipse.runtime.examples.media/icons/22/games-config-background.png");
      } else {
        p.setIconURI("platform:/plugin/at.bestsolution.efxclipse.runtime.examples.media/icons/22/player-volume.png");
      }
     
      p.setContributionURI("bundleclass://at.bestsolution.efxclipse.runtime.examples.media/at.bestsolution.efxclipse.runtime.examples.media.parts.MediaPart");
      p.getPersistedState().put(MediaPart.MEDIA_OBJECT_KEY, instance);
      stack.getChildren().add(p);
      partService.activate(p,true);     
    }
  }
View Full Code Here

       
        Button b = new Button("Toggle Rendering");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            part.setToBeRendered(!part.isToBeRendered());
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MPart> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
         
          @Override
          public ListCell<MPart> call(ListView<MPart> param) {
            return new ListCell<MPart>() {
              @Override
              protected void updateItem(MPart item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getLocalizedLabel());
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Toggle Visibile");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            part.setVisible(!part.isVisible());
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Add new Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @SuppressWarnings("unchecked")
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
           
            MPart p = BasicFactoryImpl.eINSTANCE.createPart();
            p.setLabel("New Part");
            p.setContributionURI("bundleclass://at.bestsolution.efxclipse.testcases.e4/at.bestsolution.efxclipse.testcases.e4.parts.ContentPanel");
            container.getChildren().add(p);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Remove last Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
            container.getChildren().remove(container.getChildren().size()-1);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Move last Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
            Object o = container.getChildren().remove(container.getChildren().size()-1);
            container.getChildren().add(container.getChildren().size()-1, o);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MPart> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
         
          @Override
          public ListCell<MPart> call(ListView<MPart> param) {
            return new ListCell<MPart>() {
              @Override
              protected void updateItem(MPart item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getLocalizedLabel());
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Detach");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            modelService.detach(part, 0, 0, 300, 300);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
View Full Code Here

TOP

Related Classes of org.eclipse.e4.ui.model.application.ui.basic.MPart

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.